Bourne Shell: Variable defined?

Jay Heiser jay at hqda-ai.UUCP
Tue Mar 28 06:51:01 AEST 1989


Take a look at 'test'  (type 'man test' for info).  
	[ -z "$foo" ] 	is true if the length of $foo is zero
	[ -n "$foo" ]	is true if the length of $foo is non-zero

I've found this to be more reliable than 
	[ $foo ] or X"$foo" = X

Jay G. Heiser



More information about the Comp.unix.questions mailing list