The Bash For Loop Array enables you to create a string so that you make a loop which can be seen on the output screen of Linux.
Don't forget to check out our site http://howtech.tv/ for more free how-to videos!
/ ithowtovids - our feed
/ howtechtv - join us on facebook
https://plus.google.com/1034403827176... - our group in Google+
In this tutorial we will show you how to write a bash for loop array. This command let's your make a string and form a loop that is repeated in the output. Loops and arrays are easy to create in Linux.
To understand how to create a loop array, follow the tutorial steps given below.
Step 1 -- Declare a variable and create a string
First of all, we will declare an array variable over here. Now we will create a string of element 1, 2 and 3 over here, and we will assign it in the array variable that we have already declared before.
declare --a arr=(element1 element2 element3)
Step 2 -- Loop the array
Next, we will loop through the above array and display all the elements inside the array.
For that, we will use the "at the rate" sign over here.
for i in ${arr[@]}
Step 3 -- View the output on the screen
With that done, the output of the bash loop array will be displayed on the screen.
And there you have it, a basic for command for loops and arrays written in bash.
do
echo $i
done
Auf dieser Seite können Sie das Online-Video How to Write Bash For Loop Array mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer HOWTECH 17 Juni 2013 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,904 Mal angesehen und es wurde von 15 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!