[Level 3] 1A2B shell game
Another game. # !/usr/bin/bash showUsage() { cat <<EOF Usage: $0 Ex. $0 EOF } getNum() { #set -vx sNum="0|1|2|3|4|5|6|7|8|9" sAns="" declare -i n1=$RANDOM*10/32767+1 declare -i n2=$RANDOM*9/32767+1 declare -i n3=$RANDOM*8/32767+1 declare -i n4=$RANDOM*7/32767+1 s=`echo $sNum | cut -d'|' -f$n1` && sAns=$sAns$s && sNum=`echo $sNum | sed -e "s/$s//" | sed -e 's/||/|/g' | sed -e 's/^|//g' | sed -e s'/|$//'` s=`echo $sNum | cut -d'|' -f$n2` && sAns=$sAns$s && sNum=`echo $sNum | sed -e "s/$s//" | sed -e 's/||/|/g' | sed -e 's/^|//g' | sed -e s'/|$//'` s=`echo $sNum | cut -d'|' -f$n3` && sAns=$sAns$s && sNum=`echo $sNum | sed -e "s/$s//" | sed -e 's/||/|/g' | sed -e 's/^|//g' | sed -e s'/|$//'` s=`echo $sNum | cut -d'|' -f$n4` && ...