The Unix "for loop" command

iKnow-IT banner

for-loop

$ cat For_loop1.sh
for SHELLVAR in 1 2 3 
do 
    echo $ SHELLVAR 
done 
$ ./For_loop1.sh 
1
2
3
$
$cat write_all.sh 
echo Give message 
echo Close with: \^D 
MESSAGE1=`cat` 
NAMES=`who | awk ‘{print $1}’` 
for name in $NAMES 
do 
    echo to: $name 
    write $name <<BLOCK
   $MESSAGE1
BLOCK
   echo "Message Send"
done