samedi 21 janvier 2017

Sort Random Integers in Ascending order USING IF STATEMENT. (bash scripting)

I want it to display my 2 random integers in ascending order using IF STATEMENT ONLY. bash scripting please.

#! /bin/bash
integer1=$1
integer2=$2
integer1=$[RANDOM%20+1]
integer2=$[RANDOM%20+1]

if [ ${integer1} -gt ${integer2} ]; then
   echo"$integer1"
   echo"$integer2"
else
   echo"$integer2"
   echo"$integer1"
fi
exit 0




Aucun commentaire:

Enregistrer un commentaire