I found a bunch of posts on the internet about this but I'm still running into problems. Here's my goal of my script: check to see if my external hard drive is mounted. (It's called "Files") and then use ditto to copy all the files over. I've got ditto to work but now that I'm trying to do an if-else statement it has problems.
Here's what I've got:
When I try to run the script I get this error:
./backup: line 9: syntax error: unexpected end of file
What am I doing wrong?
Here's what I've got:
Code:
#!/bin/sh
if (-e $d/$f) then
ditto -V /Users/andrew/Misc /Volumes/Files/Backup
else
echo "External drive not mounted!"
endif
When I try to run the script I get this error:
./backup: line 9: syntax error: unexpected end of file
What am I doing wrong?