Quote:
Originally Posted by lleb
Code:
for i in {0..6..1} # {START...END...INCREMENT}
do
# echo "foo.${i}.TEST"&>>grab.txt
printf 'foo.%02d'${i}'.TEST\n'&>>grab.txt
done
Question though, why %02d and not %03d.
|
In this example you print a 2 digit number
and $i. printf requires a format string and arguments. Here the argument is missing, so it is 0 always. That's why you have 00 always before $i.
From the other hand seq executed in a subshell, therefore it is much slower than any other solution.