winure/scripts/pwsh.sh

22 lines
489 B
Bash
Raw Normal View History

2024-07-03 16:20:46 -04:00
#!/usr/bin/bash
# try to use system-wide version first.
# this usually fails, but it's worth a shot.
if [[ -r '/mnt/c/Program Files/WindowsApps/' ]]; then
cd '/mnt/c/Program Files/WindowsApps/'
PWSH="`pwd`/`find Microsoft.PowerShell_* -name 'pwsh.exe'`"
cd - > /dev/null
if ! [ -x "$PWSH" ]; then
unset PWSH
fi
fi
# fall back to user installation
if [ -z ${PWSH+x} ]; then
PWSH="`dos-var -p USERPROFILE`/AppData/Local/Microsoft/WindowsApps/pwsh.exe"
2024-07-03 16:20:46 -04:00
fi
# run target
"$PWSH" $@