Want to write an order script with linux (bash) -
i have write bash shell script take in 3 integer arguments , print them out smallest largest. new linux unsure errors experiencing program. have far, whatever change never seems work.
#!/bin/bash read x y z if [ $x -lt $y && $x -lt $z ] ; if [ $y -gt $z ]; echo "$x $z $y" else echo "$x $y $z" if [ $y -lt $x && $y -lt $z ] ; if [ $x -gt $z ]; echo "$y $z $z" else echo "$y $x $z" if [ $z -lt $x && $z -lt $y ] ; if [ $z -gt $y ]; echo "$z $y $x" else echo "$z $x $y" fi
any appreciated. thank time.
it's 1 line bash code script:
#!/bin/bash echo $* | tr ' ' '\n' | sort -n | tr '\n' ' '
Comments
Post a Comment