자바스크립트를 활성화 해주세요

d009 GoormIde에 Pwsh설치하기

 ·  ☕ 2 min read

goormide는 무료로 사용할 수 있는 ubuntu container를 제공합니다. 즉, ubuntu 머신(버전는 18.04)에 pwsh를 설치해 사용하는 방법을 설명합니다.

프로젝트는 Blank Project를 선택합니다.

설치

다음의 커맨드를 사용해서 설치합니다.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
apt-get install build-essential
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Enable the "universe" repositories
sudo add-apt-repository universe
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh

확인

최신 버전은 아니지만, 괜찮습니다.

root@goorm:~# pwsh
PowerShell 7.0.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/powershell
Type 'help' to get help.

PS /root> hostname
goorm
PS /root> $host

Name             : ConsoleHost
Version          : 7.0.3
InstanceId       : 9f0b25b1-fcf1-41bf-98b4-c212a6e45c49
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : ko-KR
CurrentUICulture : ko-KR
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Set-PSReadLineOption

기본으로 설치되어 있는 모듈을 보면 PSReadLine이라는 모듈이 로드되어 있습니다.

1
2
3
4
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-ItemProperty}
Script     2.0.2                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler,

이 모듈의 공식 페이지는 https://github.com/PowerShell/PSReadLine 입니다.

PS /root> Set-PSReadLineOption -EditMode
Emacs    Vi       Windows

vi모드 입력, emacs입력을 지원하고, 키바인딩에 사용자 정의 함수를 기동시키기도 합니다. vscode 의 powershell에도 로드되어 있는 모듈이므로, 연구해 볼 만한 가치가 있습니다.

$profile

리눅스의 pwsh에도 $Profile 스크립트를 지원합니다.

PS /root> $profile
/root/.config/powershell/Microsoft.PowerShell_profile.ps1

이쪽도 커스터마이징 포인트이겠네요.

레퍼런스

공유하기

tkim
글쓴이
tkim
Software Engineer