Hello, I am writing a script in ksh(for HP Unix)where a user must answer to a question . So I want to know kow to test if the user do not answer , so if he enter "REturn".
I don't know how to test "space characters" or "empty characters
Thanks for your help
You can do stuff like this...
print -n "Enter your name - " read name if [[ -z $name ]] ; then print I guess you don\\'t know your name name="bozo" fi
From man ksh...
This is also true for a string that is "space characters" because they are internal field separators.
Example
REPLY="" while [[ -z $REPLY ]] do read REPLY?"Enter field: " if [[ -z $REPLY ]] then echo Error: field is mandatory fi done