I have been working with Linux for quite few years but never required to learn Bash and Linux really dep doan.
I want to learn bash I bought books and Have been reading on the Internet but I cannot find my answers, maybe I am blind.
For example:
What does this means?
# for i in
Where can I find what the "i" and the "in" means and their significance.
I need to nderstand where they come from and where can I find all of them, for example sometimes I see "# while -n blabla" what "-n" mean and where can I find explanations for similar things?
If you guys could give me some light I would be really happy and thankful.
Thank you for the reply.
The problem with that tutorial is it does not explain where does the "in" come from all the rest of it.
Another example: for a in blabala
Where does the "A" come from where can I find al the possibilities, such as: ! [] {} () . in a i arg exec, things like that, I would like to understand them.
I'will give an example to you which for me does not say anyting: :(){ :|:& };:
I would say that a kid was playing with the keyboard. But I tried the combination on my Linux box and it killed my box, had to re-start it.
I would like something which explains all the symbols etc.
In that particular case, the "in" word is a reserved word.
someone, while developing bash, decided to make it so.
the loop structure requires some special words to fit in all the options.
"for" is a reserved words that tells bash, a loop is about to be "declared"
the next param, is the variable that bas will use to hold the step
in tells bash that the next thing is the list to go trough. one loop for each object. on each iteration, the current value is asigned to the variable after the for but before the in
(all this is in the link frankling posted)
for a in blabla
for z in blabla
for apples in barrel
for cars in garage
for people in city
As you step through a script, the first time that the variable is called, it tells the script to assign the first entry in the file/array/something to $a or $b or $apples etc.
Once the script has completed the loop, it will ask for the next element. The script looks at the file/array/something and assigns the next value to $a/$b/etc. and the script runs the loop again. It will continue this until you run out of apples/people/elements.