![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell problem not working!!! :(( | baku | Shell Programming and Scripting | 1 | 04-10-2008 05:20 AM |
| Shell script is not working... | vishalpatel03 | Shell Programming and Scripting | 2 | 01-10-2008 02:19 PM |
| how to find in which shell i am working.. | pineapple | Shell Programming and Scripting | 2 | 04-01-2007 07:56 PM |
| shell not working | hytechpro | Shell Programming and Scripting | 0 | 01-24-2006 11:19 PM |
| bourne shell not working | gillbates | Shell Programming and Scripting | 6 | 06-17-2004 01:22 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
if -z not working in SH shell
Hello all,
Any idea how to check whether a variable holding null value or not. if -z option works fine in bash, where as it is not working in sh. bash-3.00$ sh $ TEST= $ if [ -z $TEST ] ; then > echo "Null" > else > echo "Not null" > fi sh: test: 0403-004 Specify a parameter with this command. Not null $ The test fails. The same works in bash. bash-3.00$ TEST= bash-3.00$ if [ -z $TEST ] ; then > echo "Null" > else > echo "Not null" > fi Null bash-3.00$ I need this testing working in sh. Please help. Thanks, Rijesh. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
$ if [ -z $TEST ] ; then
TRY this $ if [ ! -n $TEST ] ; then |
|
#3
|
|||
|
|||
|
try
Code:
if test -z "$TEST" then ... fi Code:
if [ -z "$TEST" ] then ... fi |
|||
| Google The UNIX and Linux Forums |