•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 428,221 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,246 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 3445 | Replies: 0
![]() |
•
•
Join Date: Oct 2004
Posts: 57
Reputation:
Rep Power: 4
Solved Threads: 0
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
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
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
#!/bin/bash
cmd1="code1" #the exact/full command
cmd2="code2" #the exact/full command
cmd3="code3" #the exact/full command
etc.
cmd1 || exit 1
cmd2 || exit 2
cmd3 || exit 3
...
cmdn || exit n
echo "Build environment entered!"
exit 0It 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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Invoking a shell script (PHP)
- mysql DELETE not working (PHP)
- Execute command or application without waiting (C++)
- Really simple script request - Count from 6 - 0 (JavaScript / DHTML / AJAX)
- Can we execute command line cmds from a php file?? (PHP)
- A simple perl script (Perl)
- script for fedora core 4 (Shell Scripting)
- [Bash] problem with script in sed command (Shell Scripting)
- Problem with variables in Windows shell script (Windows NT / 2000 / XP / 2003)
Other Threads in the Shell Scripting Forum
- Previous Thread: Execution time(plz Help)
- Next Thread: help: use of 'cmdtool'


Linear Mode