For Loop Example Bash
In this example I will be showing how for loop work.
#!/bin/sh # Validate numbers... echo "Please enter a list of numbers between 1 and 100. " read NUMBERS for NUM in $NUMBERS do if [ "$NUM" -lt 1 ] || [ "$NUM" -gt 100 ]; then echo "Invalid Number ($NUM) - Must be between 1 and 100!" else echo "$NUM is valid." fi done
Tags: For Loop If Statement Read Echo
Total Views: 723
My name is Jean-Mathieu
I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.
|jean8mathieu||Created on 02/10/15|
Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.