[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Weird shell script behavior in a cron job



A few minutes ago, with respect to my backup script attempting to mount ExternalHD if run from a command line, but not from cron, I wrote:
Why would the behavior be any different? Could it be that cron is
running it an entirely different shell, that doesn't understand the "if"
statement?

That was it. I added a line to echo $SHELL to my debugging log file, and that was it: if I ran it from cron, $SHELL was /bin/sh; if I ran it from a command line, $SHELL was /bin/bash.

Changing the shebang from
> #!
to
> #! /bin/bash

did the trick, and when I looked back at the original script, I found a shebang of
> #! /bin/sh

which I also changed. High hopes for finding successful test results tomorrow morning.

--
JHHL


Reply to: