What would be the right way to declare an array within a script that will be called by cron?

Posted by Nano Taboada on Stack Overflow See other posts from Stack Overflow or by Nano Taboada
Published on 2008-11-20T19:22:45Z Indexed on 2010/04/25 6:03 UTC
Read the original article Hit count: 218

Filed under:
|
|
|
|

I've written a Korn Shell script that sets an array the following way:

set -A fruits Apple Orange Banana Strawberry

but when I'm trying to run it from within cron, it raises the following error:

Your "cron" job on myhost
/myScript.sh

produced the following output:

myScript.sh: -A: bad option(s)

I've tried many crontab syntax variants, such as:

Attempt 1:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script/myScript.sh

Attempt 2:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script/./myScript.sh

Attempt 3:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /path/to/script && ./myScript.sh

Any workaround would be sincerely appreciated. Thanks much in advance!

© Stack Overflow or respective owner

Related posts about cron

Related posts about ksh