Shell Script To Find Largest Among 3 Integers (Numbers) Given As Arguments

in Categories Academic, Decision Making, Shell Math last updated October 20, 2008

Share this on:

8 comment

  1. i need ordinary program for linux progran for find biggest among 3 numbers using command line arguments… please help me…

  2. It is quite helpful to know how the argument list can be easily handled. Thank you very much !! I was totally confused to see a lot of complex scripts. But, this one really helped me.

  3. Um,
    echo -e "$a\n$b\n$c" | sort -rn | head -1

    big = $a;
    [ $b -gt $big ] && big=$b;
    [ $c -gt $big ] && big=$c;
    echo $big

    Have a question? Post it on our forum!