For i in 6 7 9 A B Z C N F H G M L D R S T 8


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting For i in 6 7 9 A B Z C N F H G M L D R S T 8
# 1  
Old 03-21-2019
For i in 6 7 9 A B Z C N F H G M L D R S T 8

Hello friends, good morning
can someone explain to me if he is so kind of what does this mean?

Code:
for i in 6 7 9 A B Z C N F H G M L D R S T 8
do

  echo "input: " $1

done

# 2  
Old 03-21-2019
It is much easier to look at the result of work this code.
Code:
#!/bin/bash
for i in 6 7 9 A B Z C N F H G M L D R S T 8
do
    echo "input: " $i
done

This User Gave Thanks to nezabudka For This Post:
# 3  
Old 03-21-2019
I have to second nezabudka: Why not just run the command, mayhap after consulting man bash:
Quote:
for name [ [ in [ word ... ] ] ; ] do list ; done
The list of words following in is expanded, generating a list of items. The variable name is set to each element of this list in turn, and list is executed each time.
On the other hand, I have to admit that it may not be the wisest thing to run code that you don't understand (way more complex than above, of course) on a production system. Not a bad idea to have some playground system up your sleeve to test / debug suspect software.
Or use a web test ground like ideone.com.
These 4 Users Gave Thanks to RudiC For This Post:
# 4  
Old 03-21-2019
thank you !!!!

Rudic!!!
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question