for i in $(seq 1 10)
do
echo ${i}
done
Note that enclosing variables in curly braces is not required but will never let you down. Take the following code, for example:
i=1
echo $i # works
echo $i5 # won't work!
echo ${i}5 # works!
Enclosing the variable in curly braces allows you to use the variable anywhere, without fear of Bash interpreting surrounding characters as part of the variable.
No comments:
Post a Comment