If you’re playing with Powershell under Mac (see https://github.com/PowerShell/PowerShell ) you reach a point where you want to quickly install and uninstall Powershell from the command line. Thus, the following two scripts.
First to install;
#!/usr/bin/env bashfile=`ls powershell*`[ -z "$file" ] && echo "Cannot find powershell installer" || sudo installer -pkg ${file} -target /
Then to uninstall;
#!/usr/bin/env bashsudo rm -rf /usr/local/bin/powershell /usr/local/microsoft/powershell
You can name these whatever you want (I chose install-powershell.sh and uninstall-powershell.sh respectively) and remember to set their permissions respectively. Make sure the install script is in the same directory with the the Powershell dmg file, otherwise you can run the uninstall script from anywhere.