Published on April 9, 2017 by ProgrammingKnowledge

FOR loop to execute commands. A list of commands is executed for each value in the list.
for Loops: Sometimes we want to run a command (or group of commands) over and over. This is called iteration, repetition, or looping. The most commonly used shell repetition structure is the for loop, which has the general form:
for variable in list
do
command(s)
done

My Website – www.codebind.com
My Blog – goo.gl/Nd2pFn
My Facebook Page – goo.gl/eLp2cQ
Google+ – goo.gl/lvC5FX
Twitter – twitter.com/ProgrammingKnow
Pinterest – goo.gl/kCInUp
Text Case Converter – goo.gl/pVpcwL
Epoch Timestamp Converter – goo.gl/Zedjo5
Decimal – Binary – Hexadecimal Converter – goo.gl/rkX3JE
8-bit Checksum Calculator – goo.gl/inxvIT

Leave a Reply

8 Comments on "Shell Scripting Tutorial for Beginners 20 – use FOR loop to execute commands"

Notify of
avatar

nazareth garate
Guest
nazareth garate
2 days 16 hours ago

hi there, please hekp me i saw a video in your channel about NumberPicker how can i retrieve the value from a numberPiker inside a cardview when i push a button?, I know there is a TextWacher, but there is not such a thing for numberPicker, so what can i do please?

En Route
Guest
En Route
8 days 1 hour ago

this is a humble request sir. please make a video on audio programming and building audio related applications (like audacity) for Windows that involve DFT, FFT etc.I will be grateful to you.

Squidgy Testicle
Guest
Squidgy Testicle
13 days 9 hours ago

It failed mainly because you didn't add quotes around the variables. Ex:for FILE in *; { [ -f "$FILE" ] && echo "$FILE"; }By the way, that's alternative syntax for a for loop, but handy as it's shorter. That works in bash. In zsh, you can omit the last colon and needn't have space after and before the first and last brace, respectively.Another variant is the c style:for {I=0;I<=10;I++}; { echo $I; }You may have seen that in an awk for loop:awk 'BEGIN{for(I=0;I<=10;I++) print(I)}'

Gurpreet Singh
Guest
Gurpreet Singh
14 days 6 hours ago

nice job sir can you make a video on how to send message from computer to multiple no. in one time in the name of institution like school without showing number

xploit
Guest
xploit
15 days 20 hours ago

thanks brother for your greats helpfull videos and eplaintation.can you brother eplain us how to to deploy website(not only for localhost) but brother in internet,i tried to publish my site using IIS(WIN 7);but i can not find it out of localhost .i use wifi and win 7 and i want that my site will be deploy on internet that i can find it over internet.please brother help me.thanks a lot of

Dr. Daniel Khoshnoudirad
Guest
Dr. Daniel Khoshnoudirad
16 days 22 hours ago

Excellent ! I like the video (blue finger) Many thanks for this interesting video

AJAY SHARMA
Guest
AJAY SHARMA
17 days 3 hours ago

thank you sir for you help!

farshad alaei
Guest
farshad alaei
17 days 7 hours ago

hey man i hope you are doing well what if i had question ? can you us your emaill address please ?

wpDiscuz