Re: Weird shell script behavior in a cron job
- Date: Thu, 31 Aug 2017 08:03:51 -0400
- From: Greg Wooledge <wooledg@xxxxxxxxxxx>
- Subject: Re: Weird shell script behavior in a cron job
On Thu, Aug 31, 2017 at 06:52:28AM +0100, Jonathan de Boyne Pollard wrote:
> James H. H. Lampert:
> > Could it be that |cron| is running it an entirely different shell, that
> > doesn't understand the |if| statement?
> Despite what others have said, the answer to this question is no. Whilst
> you /are/ running two different shells, the problem is not the |if|
The if statement that he actually *showed* was POSIX-compatible, yes.
But he later said that changing the shebang fixed his problem, so
there was some other part of his script that was bash-specific.