I'm a novice, but I tried to recreate the BASIC code in from the first picture in Bash and I can't get it to behave correctly. Any ideas?
Code:#!/bin/bash for ((i=1; i<=20; i++)) do for ((j=1; j<=$i; j++)) do echo $j$i done done
The variable i should not be printed to the screen. And you must prevent the inner loop from writing a newline character.
Code:
#!/bin/bash
for ((i=1; i<=20; i++)); do
for ((j=1; j<=$i; j++)); do
echo -n $j
done
echo
done