Ah grasshoppers...
/me wonders if anyone will get the full significance of that..
On 10/9/10 3:39 PM, Devin Teske wrote:
On Oct 9, 2010, at 1:25 PM, Garrett Cooper wrote:
Why not just do...
if [ "x$rc_conf_files" = x -o "x$varname" = x ]
then
return ${FAILURE-1}
fi
I think you'll find (quite pleasantly) that if you intonate the lines...
"rc_conf_files [is non-null] OR return failure"
"varname [is non-null] OR return failure"
Sounds a lot better/cleaner than the intonation of the suggested replacement:
"if x plus rc_conf_files expands to something that is not equal to x OR x
plus the expansion of varname is not x then return failure"
For what it matters, I'v enever found the [ "x$foo" = "x" ] construct
to be useful.
the quoting seems to work for everything I've ever worked on.
so "officially" I'd express it as:
if [ -n "$rc_conf_files" -o -n "$varname" ]
but if I were hacking I'd probably express it as
if [ "$rc_conf_files" != "" ] || [ "$varname" != "" ]
then
.....
I also sometimes find the use of the (()) operator to be useful.
Now One thing that should be bourne in mind (heh) is that
as there is a 'usual' form of format for perl there is one for sh as
well so it's not "polite"
to make one's sh code look like perl. :-)
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"