Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell script to find the smallest of three numbers

Posted By: Rachel Fischer     Category: Unix / Linux / Ubuntu     Views: 18318

Write a shell script to find the smallest of three numbers.

Code for Write a shell script to find the smallest of three numbers in Unix / Linux / Ubuntu

echo Enter 3 numbers with spaces in between
read a b c
s=$a
if [ $b -lt $s ]
then
s=$b
fi
if [ $c -lt $s ]
then
s=$c
fi
echo Smallest of $a $b $c is $s
  
Share: 



Rachel Fischer
Rachel Fischer author of Write a shell script to find the smallest of three numbers is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!