0
我有一個腳本,在Mac上本地執行時可以正常運行。Bash腳本在本地工作,但不是從服務器
# Ask to make system changes
read -p "Would You Like to make system changes? (Finder, etc...) ? (y/n)?" CONT
if [ "$CONT" == "y" ]; then
# Keep-alive: update existing `sudo` time stamp until `mac.sh` has finished
echo "Keep this mac alive while ding this task..."
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Show Date on menubar
echo "Showing Date on menubar..."
defaults write com.apple.menuextra.clock.plist DateFormat "EEE dd MMM h:mm:ss a"
killall "SystemUIServer";
else
echo "Done makng system changes"
fi
但是當我嘗試遠程像這樣:
curl -s https://192.168.63.23/mac.sh --insecure | sh
我得到這個錯誤:
sh: line 93: syntax error near unexpected token `else'
sh: line 93: `else'
嘗試從'bash'而不是'sh'執行它。 –