read s a=(${s//,/ }) t=$((${a[0]}-1)) if test $t -eq ${a[1]}; then echo ${a[0]} else echo $((t?$t:1)) fi