Loops in UNIX Shell Scripts - for Statement
The for statement lets iterations through a list of values.
Syntax:
for variable in list_of_values; do
commands
done
Example:
The example script lists files and directories (with their content) starting with the letter a, b and c.
#!/bin/sh
for i in a b c; do
ls ${i}*
done
exit 0
Syntax:
for variable in list_of_values; do
commands
done
Example:
The example script lists files and directories (with their content) starting with the letter a, b and c.
#!/bin/sh
for i in a b c; do
ls ${i}*
done
exit 0
Comments
Post a Comment