Start New Discussion within our Software Development Community

Hi,

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 :
````````

#!/bin/sh
#
#
#i=1
#while [ $i -le 3 ]
#do
# i=`expr $i + 1`
#done

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

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 article has been dead for over six months. Start a new discussion instead.