Web lists-archives.com

Re: Weird shell script behavior in a cron job

On 8/31/17, 5:16 AM, Reco wrote:
$ bash -c 'cd foo; echo $?'
bash: line 0: cd: foo: No such file or directory

To this:

$ dash -c 'cd foo; echo $?'
dash: 1: cd: can't cd to foo

Aha! That's what it was! Thanks!

At any rate, changing the test script's utterly nonspecific shebang (that, I gather, essentially just said "this is a script, but you're on your own to figure out what interpreter it wants"), and the backup script's "#!/bin/sh" shebang both to a "#!/bin/bash" shebang solved the problem quite nicely.

And late last night (actually, early this morning), after I'd left the box with Gnome signed off and ExternalHD very deliberately unmounted, the backup script worked perfectly.