Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # do while example with sh, and It is the infinite loop.
- # tips from man sh.
- # = Main =
- #f="0"
- #while : f
- #do
- # f=$(($f + 1)) # like java`s "f = f + 1;"
- #
- # if [ $f -lt 10 ]; then
- # echo "0$f"
- # else
- # echo "$f"
- # fi
- # sleep 3
- #done
- padtowidth=2
- while : f
- do
- f=$(($f + 1)) # like java`s "f = f + 1;"
- printf "%0*d\n" $padtowidth $f;
- sleep 3
- done
- # = Result =
- 01
- 02 # inter 3s.
- 03
- ...
- # = Reference =
- # * In bash, how could I add integers with leading zeroes and maintain a specified buffer - Stack Overflow http://stackoverflow.com/questions/3191067/in-bash-how-could-i-add-integers-with-leading-zeroes-and-maintain-a-specified-b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement