Search Results

Search: Posts Made By: era
31,623
Posted By era
test -z $username expands to test -z a b which is...
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"...
31,623
Posted By era
The following will fail if there is a space...
The following will fail if there is a space anywhere in the input.

case $string in *\ *) echo try again;; *) break;; esac

If you want to use egrep, you can avoid the Useless Use of Test $?...
31,623
Posted By era
You need to quote "$string" inside double quotes...
You need to quote "$string" inside double quotes if it contains any whitespace. Aside from that, it might be more elegant to use case instead of if, especially for coping with all-whitespace input...
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 08:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy