From: Rafael L. <lab...@ps...> - 2003-01-31 23:47:29
|
* Alan W. Irwin <ir...@be...> [2003-01-31 13:00]: > Since I didn't completely understand Rafael's suggested syntax, I tested > this both with swig version 1.3.17 and other versions, and it does what it > is supposed to do. Come on, you have never written programs in sed before? You are not a real man... :-) > But, Rafael, if you have any ideas on how to change that test to < "17", by > all means do so. Done. The trick is to use shell arithmetic evaluation: var=4 if test $(($var > 2)) = 1 ; then echo Yes, \$var is greater than 2 ; fi This is standard Bourne shell, no bashisms here. > (A test for < "17" does not work and gives an error message concerning an > unknown file 17.) This happens because the shell interprets the token ">"as file redirection. and not one of the arguments of the test command (like it does for "=" or "!="). -- Rafael |