Difference between revisions of "bash testing variables for negative numbers or values"

From thelinuxwiki
Jump to: navigation, search
(Created page with "use test then check its exit value ($? = exit value of the previous command) $ test -4 -lt 0; echo $?; 0 $ test 4 -lt 0; echo $?; 1 category:bash category:scripting")
 

Latest revision as of 21:55, 10 July 2014

use test then check its exit value ($? = exit value of the previous command)

$ test -4 -lt 0; echo $?;
0
$ test 4 -lt 0; echo $?;
1