``` #! /bin/env bash read -p "input a number:" num for ((i=1;i<=$num;i++)) do for ((j=1;j<=i;j++)) do echo -n $j done echo done for ((i=1;i<=$num;i++)) do str="" for ((j=1;j<=i;j++)) do str=$str$j done echo $str done ``` ``` me@me-EQ59:~/shell_demo/scripts/shell02$ ./print-1-5.sh input a number:6 1 12 123 1234 12345 123456 1 12 123 1234 12345 123456 me@me-EQ59:~/shell_demo/scripts/shell02$ ```