Skip to content

Instantly share code, notes, and snippets.

@berkes
Created December 8, 2015 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save berkes/4d05ad9e51e101ea8adf to your computer and use it in GitHub Desktop.
Save berkes/4d05ad9e51e101ea8adf to your computer and use it in GitHub Desktop.
number=$1
prime=true
#for i in {1.."$number"}
for i in $(seq 2 1 $(($number - 1)))
do
if [ $(($number % $i)) -eq 0 ]
then
prime=false
out="$out \n number $i a factor"
fi
done
if [ "$prime" = true ]
then
echo "Optimus Prime!"
fi
echo -e $out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment