Practical LPIC-1 Linux Certification Study Guide by David Clinton
Author:David Clinton
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA
Loops
Many scripts require repeated actions while—or until—a certain condition is met. You might, for example, want a script to launch some process only after a preceding process has completed. You could write a script to test for the existence of the first process so that, when the test fails, the new process is started.
Like anything else related to scripting, there really is no end to the possible scenarios a fertile imagination can dream up. Unfortunately, to illustrate the principles, you’ll have to come back to my silly and unimaginative examples.
Here’s a loop that, using while, will continue as long as a variable called COUNTER—set to start at 10 and reduced one integer at a time—remains higher than 2. Try it for yourself:
#!/bin/bash
#example of while loop:
declare -i COUNTER
COUNTER=10
while [ $COUNTER -gt 2 ]; do
echo The counter is $COUNTER
COUNTER=COUNTER-1
done
exit 0
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(26291)
Hello! Python by Anthony Briggs(25216)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(24446)
Kotlin in Action by Dmitry Jemerov(23536)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(22880)
Dependency Injection in .NET by Mark Seemann(22667)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21431)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20273)
Grails in Action by Glen Smith Peter Ledbrook(19343)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17056)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16366)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14077)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12255)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11533)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10645)
Hit Refresh by Satya Nadella(9221)
The Kubernetes Operator Framework Book by Michael Dame(8579)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8432)
Robo-Advisor with Python by Aki Ranin(8376)