The above sh script can be rewritten to use for:-
#!/bin/bash for var do echo $var done exit 0
By default the variable ``var'' is assigned the value of each input argument in turn. This works even if there are null string arguments. However you can provide a list of values:-
#!/bin/bash for var in abc \ def \ ghi do echo $var done exit 0
which produces the output:-
abc
def
ghi