My bash/nohup experience is very limited, so I might be making a basic mistake.
I'm launching a background file monitor. (In case it matters, Sass is a CSS preprocessor that can monitor source files and automatically compile them into CSS when it detects changes.)
When I enter this at a shell prompt, it launches the Sass file monitor perfectly:
nohup sass --watch /data/sass/:/data/css/ > /var/log/sass.out 2> /var/log/sass.err &
But when I put it in a script like this (a simplified sample script for debugging):
COMMAND="[exactly the same command as above]"
I get this error:
nohup: ignoring input and redirecting stderr to stdout
Errno::ENOENT: No such file or directory - > Use --trace for backtrace. >>>
Sass is watching for changes. Press Ctrl-C to stop.
The same thing happens if I specify the full path /usr/bin/local/sass. Any idea where I'm going wrong?
You can't run a complex command (e.g. with redirection) via:
You can only really do this if you are running a simple binary or script.
$COMMAND needs to be expanded properly before executing, so you need to run:
echo `eval $COMMAND`