I have been attempting to create a file out of my loop in bash , I was successful in generating the file with the following code
for ((i = 0; i <= 5; i++)); do
for ((j = i; j <= 5; j++)); do
echo -e "$i $j" >> numbers.txt
done
done
however I want my results to be out in the following fashion
01
02
03
etc.
But the result I am getting is similar to this
0 0 1 0 2 0 3 0 4 0 5 1 1 1 2 1 3 1 4 1 5 2 2 2 3 2 4 2 5 3 3 3 4 3 5
How can I solve this ?
printf
for formatted outputprintf '%d%d\n' "$i" "$j"
. – steeldriver Jun 24 '16 at 19:59echo -n
. What platform are you on? – leekaiinthesky Jun 24 '16 at 20:44for i in {0..5}; do for j in {1..5}; do printf "%d%d\n\n" "$i" "$j"; done; done
– cas Jun 25 '16 at 03:41