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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -