![]() |
Need help in writing a shell script
Hey guys
N00b on programming.. trying to write a shell script to run a command via cronjob.. Say there are two variables Code:
live="a b c"I need to run something like this. merge.sh is another script which is run Code:
merge.sh $LIVE -n $data ~/dumping/$LIVE.datQuote:
Code:
for DB in $LIVE; doPlease help |
Hi.
Try using bash arrays: Code:
live=(a b c) |
Hi
I am getting an error Quote:
Quote:
|
Umm.. nevermind got it working by changing
Quote:
Quote:
|
Hi.
You probably run this script via sh: Code:
$ sh ./test.sh Code:
$ bash ./test.sh Code:
#!/bin/bash |
nevermind :)
|
Is there anyway I can do the above in /bin/sh
There is a requirement it seems.. |
that greatly depends what /bin/sh really is.
In many distributions (clearly not yours) it's actually bash; on others it may be the "real" sh, meaning that there are little to no extras... You could work around that and join those things in a (very inefficient) way like this: Code:
#check the number of fields of the variables/bin/ksh should work as well as /bin/bash for the scripts/hints posted by the others. |
| All times are GMT -5. The time now is 11:46 AM. |