Is there a way to run stateful bash scripts in automator?
I'm trying to run something depending if a file does or does not exist. With bash script alone in terminal the code below works and will show the correct output, depending on wether the file exists or not.
Only one line of output per run of the script is displayed either way.
FILE="/Volumes/Canvio1TB/EyeTV Archive/sync.ffs_lock" if test -f "$FILE"; then echo "$FILE exists" else echo "$FILE does not exist" fi
When I run this in automator as a "run shell script" action the output is:
/Volumes/Canvio1TB/EyeTV Archive/sync.ffs_lock exists
/Volumes/Canvio1TB/EyeTV Archive/sync.ffs_lock does not exist
Regardless of wether the file exists or not, the script generates both lines of output.
If there's a better approach I'd be open to using it - I haven't had success with the syntax of applescript running a command based on the (non)existence of a full path & file.