cur=$(date +%m) # Need not be described next6=$(printf %02d $(echo $(($cur+6))%12 | bc)) # 1. $(($cur+6)) is same 'expr' command. result is 7 # 2. echo 7%12 | bc result '7' (remainder) # 3. printf %02d => 01, 02, 03 ... # 4. $next6 => current month + 6 # 5. My mistake, if $next6 is 0 => change 1 (if [ $next6 == 0 ];then next6=1;fi) # 6. END next6_y=$(echo $(($cur+6))/12 + $(date +%Y) | bc) # 1. $(($cur+6)) is same 'expr' command. result is 7 # 2. echo 7/12 | bc result '0' (quotient) # 3. $(date +%Y) ==> 2016 # 4. 0 + 2016 | bc ==> 2016 # 5. END