4. Shell script to find maximum and minimum of given set.
echo "enter the name of the file that contains number in it"
read filename
min=`cat $filename | sort -n | head -1`
echo "minimum value = $min"
max=`cat $filename | sort -n | tail -1`
echo "maximum value = $max"
read filename
min=`cat $filename | sort -n | head -1`
echo "minimum value = $min"
max=`cat $filename | sort -n | tail -1`
echo "maximum value = $max"
Leave a Comment