I am trying to call a certain command from within a shell script, but everytime it executes the script, only the first command runs and it comes out of the control, how do i do it?
code :

#while [ $i -le 3 ]
# i=`expr $i + 1`

StoreXML -project xnat -l work/sample1.xml -u admin -p admin -allowDataDeletion true
StoreXML -project xnat -l work/samnew.xml -u admin -p admin -allowDataDeletion true
StoreXML -project xnat -l work/sample.xml -u admin -p admin -allowDataDeletion true
StoreXML -project xnat -l work/latest.xml -u admin -p admin -allowDataDeletion true

#StoreXML -project xnat -l work/*.xml -u admin -p admin -allowDataDeletion true

While the control comes to the first storexml, it stores the data and exits and doesn't executes the 2nd store xml command.

also, note the last line in the code...I tried storing all the xml files at once, but this too didn't work..
It stores the first xml file and exits.
what's d soln to this..ne type of help is highly appreciated

10 Years
Discussion Span
Last Post by eggi

Hey THere,

It sounds like the command itself is exiting the script's subshell. Try running each command bckgrounded in a subshell, like this:

(StoreXML -project xnat -l work/sample1.xml -u admin -p admin -allowDataDeletion true &)

or, if you don't want the process to completely detach from the controlling terminal, just background them, although this has less probability of working in your situation

StoreXML -project xnat -l work/sample1.xml -u admin -p admin -allowDataDeletion true &

Hope that helps :)

, MIke

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.