[PLUG] How to test a string against a blank string in shell script
gauravggs at gmail.com
Thu Mar 25 09:39:20 PDT 2010
On Thu, Mar 25, 2010 at 5:43 PM, Shreerang Patwardhan
<patwardhan.shreerang at gmail.com> wrote:
> Hey all,
> I found the solution to my problem which was as stated below:
> How do we compare a string with a blank string.
> Example: String 1 = test
> String 2 =
to test for a blank string in shell scripting use
-z string returns True if the length of string is zero.
-n string True if the length of string is non-zero.
if you want to consider a string containing all spaces check it with grep!!!
More information about the plug-mail