Let’s say I type in the following commands:
/usr/local/bin/wget -O "/storehere.xml" "download1" && ./parse_xml;/usr/local/bin/wget -O "/storehere.xml" "download2" && ./parse_xml;
To my understanding, the shell will execute parse_xml after download1 is retrieved and stored. However, what is not clear to me is when will the next wget command for download 2 be executed? After parse_xml is done executing (the first time of course)? Or after a request to execute parse_xml is made? If the answer it the latter one, I would like to know a way to make my script wait for a return code from parse_xml before executing the next wget.
Thanks.
In your case, each command is invoked and completed successfully (or failed) before the next command is invoked.
Explanation:
&¬ation that demarcates different commands on a single line means “If the command before && executed successfully (return code,$?is zero), then do the command after the &&”;notation that demarcates different commands on a single line means “Run the command before the ‘;’, then the command after it, regardless of whether the first command succeeded or not.To test this, you can try these 2 different commands on your prompt: