Programming Tips - bash: How can I increment a variable in a loop?

Date: 2016mar6 Language: bash Q. bash: How can I increment a variable in a loop? A. The modern way to increment a variable in bash is:
((var++))
where var is the name of your variable. In a loop:
i=1 for orig in `ls *.jpg`; do padded=`printf '%03d' $i` mv $orig $padded.jpg ((i++)) done