Difference between revisions of "Ubuntu (PowerShell)"

From vwiki
Jump to navigation Jump to search
(Initial creation)
 
(Added Path Permission Error)
 
Line 5: Line 5:
  wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  dpkg -i packages-microsoft-prod.deb
  dpkg -i packages-microsoft-prod.deb
=== Path Permission Error ===
If you get the following error whenever running a command - '''Error reading or writing history file'''.  Its likely PowerShell was installed as root, but you're now running as a standard user, do the following...
sudo pwsh
$refDir = Resolve-Path '~'
$dstDir = Resolve-Path '~/.local/share/powershell'
chown -R --reference=$refDir $dstDir
exit
Above came from https://github.com/PowerShell/PowerShell/issues/10601
== Getting Started ==
To enter the PowerShell command line interface use the following command
pwsh
To run a PowerShell script
pwsh ./do-something.ps1


[[Category:Ubuntu]]
[[Category:Ubuntu]]
[[Category:PowerShell]]
[[Category:PowerShell]]

Latest revision as of 13:19, 5 December 2021

Installation

For the latest info, see https://docs.microsoft.com/en-us/powershell/scripting/install/install-ubuntu

apt install wget apt-transport-https software-properties-common
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb

Path Permission Error

If you get the following error whenever running a command - Error reading or writing history file. Its likely PowerShell was installed as root, but you're now running as a standard user, do the following...

sudo pwsh
$refDir = Resolve-Path '~'
$dstDir = Resolve-Path '~/.local/share/powershell'
chown -R --reference=$refDir $dstDir
exit

Above came from https://github.com/PowerShell/PowerShell/issues/10601

Getting Started

To enter the PowerShell command line interface use the following command

pwsh

To run a PowerShell script

pwsh ./do-something.ps1