I am new to writing shell scripts for Unix and need a little help. I am not sure why cURL now all of the sudden after running the script is downloading corrupts packages which cannot be mounted and why running the commands separately in Terminal work, but during the script everything fails such as
For cURL it comes back saying command not found For the mv command it says cannot find file or directory and of course mounting and everything thereafter fail.
Could you please take a look at the shell script to see what is missing or I am doing wrong?
#!/bin/sh
#Machines must have cURL installed as a prerequisite to download software from internet or FTP server
# grab files from www.teamviewer.com or custom FTP server
curl -O http://download.teamviewer.com/download/TeamViewerHost.dmg
# grab TeamViewer from custom FTP server
curl -O https://www.dropbox.com/s/***********/com.TeamViewer8.Settings.plist
# Wait for download
sleep 30s
# Place customized plist file into Library/Preferences
mv ~/Downloads/com.TeamViewer8.Settings.plist /Library/Preferences/
# Mount and Install TeamViewer
hdiutil mount ~/Downloads/TeamViewerHost.dmg
installer -pkg /Volumes/TeamViewerHost/Install\ TeamViewerHost.pkg -target /
# Unmount package
hdiutil unmount /Volumes/TeamViewerHost/
set -eux
to the top of your script. This will lead to it stopping when the first command fails.