First of all, use code tags.
Quote:
Originally Posted by jim_geek
for ((i=0;i < 5;i++))
do
j=$j;
while [ $j -ne 0 ]
do
echo $j \n;
j=$(($j-1));
done
done
|
"echo $j \n" clearly won't work. Bash doesn't interpret backslash escape sequences like C does. The are only interpreted that way in a single-quotes string preceeded by a "$" character, like this:
Also, echo automatically adds a newline, so it isn't necessary in the first place.
Finally, What's th point of the "j=$j" line? I think you mean "j=$i". This is the corrented code:
Code:
for (( i=0; i<5; i++))
do
for (( j=1; j<=i; j++ ))
do
echo -n $j
done
echo
done