The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Check space utilization in recursive mode sureshg_sampat Shell Programming and Scripting 1 06-02-2008 10:56 AM
Please help - disk space check script maddhadder71 Shell Programming and Scripting 0 05-08-2008 05:16 AM
read string, check string length and cut ozzy80 Shell Programming and Scripting 9 03-21-2007 02:56 PM
check space !!! kamlesh_p Shell Programming and Scripting 2 11-09-2005 11:01 AM
Check directory space? lesstjm Shell Programming and Scripting 3 04-19-2002 06:10 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 07-29-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
test -z $username expands to test -z a b which is a syntax error, because test -z only expects one argument. By adding double quotes, like test -z "$username", the expansion becomes test -z "a b" which has only a single, double-quoted argument. That will fix the syntax error.

However, test -z only checks for an empty string, but will treat a string with characters in it (even if they are blanks) as non-empty. I would recommend that you try the case approach instead. If it doesn't work, perhaps you can follow up here.

Not to sound too harsh, but I already explained this in how to check if a string consist of any space?
Reply With Quote
Google The UNIX and Linux Forums
Forum Sponsor
Reply

Tags
spacing, string

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0