Posts

Showing posts with the label Shell

Again Diamond ..

c=25; for i in {1..25}; do temp=$c; while [ $temp -gt 0 ]; do printf " "; temp=$(( temp - 1 )); done; j=$i; if [ $j -eq 1 ]; then printf "*"; else v=$(( j * 2 )); while [ $v -gt 0 ]; do printf "*"; v=$(( v - 1 )); done; fi; c=$(( c - 1 )); printf "\n"; done; v=1;a=25; while [ $a -gt 0 ]; do j=$(( 25 - a )); while [ $j -ge 0 ]; do printf " "; j=$(( j - 1 )); done; t=$(( a * 2 )); while [ $t -gt 0 ] ; do printf "*"; t=$(( t - 1)); done; a=$(( a - 1 )); if [ $a -eq -1 ] ; then printf "*"; fi; printf "\n"; done;