[PLUG] SOLVED: Re: bash vs dash and the "at" command

frankhunt fh-linux at frankhunt.com
Mon Oct 25 20:48:41 UTC 2010


Since dash doesn't like the "let" command, I figured out how to generate 
my random numbers without using it.  Now dash is happy and my script 
runs under at.  Life is good.



On 10/25/2010 12:11 PM, Fred James wrote:
> frankhunt wrote:
>> Does the "at" scheduler use bash or dash?
>>
>> I have a shell script that runs just fine via cron or command line
>> It generates errors if run via "at" and does not complete
>> The errors seem to be related to the use of the "let" statement
>> My test script fails the same way from command line if I include 
>> #!/bin/dash
>> Runs fine with #!/bin/bash
>> This leads me to believe that the at scheduler uses dash no matter 
>> what is in the script file.
>> Of course trying to google for anything with "at" in the search 
>> string returns a zillion hits none of which
>> are relevant.
>>
>> I am running Ubuntu 10.10
>>
>> Here's the test script it generates a random number of hours between 
>> 24 and 36 which is used in the real script at the offset to schedule 
>> itself again via "at":
>>
>> #!/bin/bash
>> MAX=36
>> MIN=24
>> number_hours=0
>> while [ "$number_hours" -le $MIN ]
>> do
>> number_hours=$RANDOM
>> let "number_hours %= $MAX"
>> done
>> echo "number_hours=" $number_hours
>>
>>
>> Ideas??
>
>

-- 
frank hunt
(L0F) R0B-ZAR1
befuddled linux admin
erstwhile photographer
hillsboro oregon




More information about the PLUG mailing list