A simple script to execute a command package

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2004
Posts: 57
Reputation: satimis is an unknown quantity at this point 
Solved Threads: 0
satimis satimis is offline Offline
Junior Poster in Training

A simple script to execute a command package

 
0
  #1
Aug 9th, 2005
Hi folks,

I'm prepared to write a simple script to execute 20+ commands and could not figure out how to make use of "loop" subject to certain conditions.

If without conditions
Shell Scripting Syntax (Toggle Plain Text)
  1. #!/bin/bash
  2.  
  3. cmd1="code1" #the exact/full command
  4. cmd2="code2" #the exact/full command
  5. cmd3="code3" #the exact/full command
  6. etc.
  7.  
  8. cmd1 || exit 1
  9. cmd2 || exit 2
  10. cmd3 || exit 3
  11. ...
  12. cmdn || exit n
  13. echo "Build environment entered!"
  14. exit 0

It will be a long script. Please advise how to apply "loop" to shorter the script executing all command subject to following conditions

1) All commands except cmd3 should have no output. If there is any it needs to confirm either to continue OR to exit the shell

2) cmd3 should have "/mnt/lfs" output. If no output OR empty output the shell should exit, not continue executing further commands

TIA

satimis
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC