DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34870>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34870





------- Additional Comments From [EMAIL PROTECTED]  2005-07-08 19:45 -------
In my experience HP-UX /bin/sh and /bin/ksh treats using unset environment
variables as an script error/abort. i.e. If VARX is not set, using ${VARX}
causes a shell script ending error.  Some OSes follow this error scheme, some do
not (treat it as an error).

To get around that shell error, you can use the Bourne Shell ':-' notation
within variable references: "${VARX:-foo}" means "Substitute with the value of
VARX. If VARX is not set, use the value following the dash (in this case 'foo')
instead". If you leave the value off "${VARX:-}", it means "If VARX is not set,
use the value following the dash (in this case nothing) instead." It's an easy
way to get around unset variable shell error. This type of notation should be
supported in all Bourne shell derivatives (it works on HP-UX, Solaris, AIX and
Linux 'cause I use it all the time).

So, while this may work under Linux/bash and cause a script error/abort under 
HP-UX:

if [ "${a}x" = "x" ]; then echo "a is not set"; else echo "a is set"; fi

This produces the desired result without error in both:

if [ "${a:-}x" = "x" ]; then echo "a is not set"; else echo "a is set"; fi

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to