Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-25 Thread Christopher Schultz
Mladen, On 7/17/13 7:59 AM, Mladen Turk wrote: > On 07/16/2013 11:42 PM, Christopher Schultz wrote: >> All, >> >> While doing the trivial fix for >> https://issues.apache.org/bugzilla/show_bug.cgi?id=55268, I noticed a >> few idioms being used in bin/daemon.sh that struck me as odd. For >> example

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-22 Thread Christopher Schultz
Mladen, On 7/17/13 7:59 AM, Mladen Turk wrote: > On 07/16/2013 11:42 PM, Christopher Schultz wrote: >> All, >> >> While doing the trivial fix for >> https://issues.apache.org/bugzilla/show_bug.cgi?id=55268, I noticed a >> few idioms being used in bin/daemon.sh that struck me as odd. For >> example

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-18 Thread sebb
On 18 July 2013 10:13, Rainer Jung wrote: > On 18.07.2013 06:04, Mladen Turk wrote: >> On 07/17/2013 11:59 PM, sebb wrote: >>> Regardless, please consider documenting the script to explain why it >>> does not use -n/-z if that is necessary to avoid bugs. >>> >> >> It would be the same as documenti

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-18 Thread Rainer Jung
On 18.07.2013 06:04, Mladen Turk wrote: > On 07/17/2013 11:59 PM, sebb wrote: >> Regardless, please consider documenting the script to explain why it >> does not use -n/-z if that is necessary to avoid bugs. >> > > It would be the same as documenting why one uses a+=1 instead a++ :) > I don't see

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread Mladen Turk
On 07/17/2013 11:59 PM, sebb wrote: Regardless, please consider documenting the script to explain why it does not use -n/-z if that is necessary to avoid bugs. It would be the same as documenting why one uses a+=1 instead a++ :) I don't see where its written that one *must* use -n/-z at the fi

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread sebb
Regardless, please consider documenting the script to explain why it does not use -n/-z if that is necessary to avoid bugs. On 17 July 2013 20:26, Christopher Schultz wrote: > Mladen, > > On 7/17/13 1:07 PM, Mladen Turk wrote: >> On 07/17/2013 06:05 PM, sebb wrote: >>> >>> Why not use: >>> >>> if

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread Christopher Schultz
Mladen, On 7/17/13 1:07 PM, Mladen Turk wrote: > On 07/17/2013 06:05 PM, sebb wrote: >> >> Why not use: >> >> if [ "$FOO" != "" ] >> > > Some shells do not allow that (comparing empty strings) I don't know of a shell where "$FOO" would be unset and yet expand to some non-zero-length string in a

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread Mladen Turk
On 07/17/2013 06:05 PM, sebb wrote: Why not use: if [ "$FOO" != "" ] Some shells do not allow that (comparing empty strings) The . is not very obvious in some fonts, and it's more symmetrical to quote both sides. Some time its used [ "x$FOO" != x ] The same way as '[ "x$FOO" = xyes ]',

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread sebb
On 17 July 2013 15:50, Mladen Turk wrote: > On 07/17/2013 04:01 PM, sebb wrote: >> >> May I suggest a short comment is added to the script to document why >> -z and -n are not used? >> Someone else reading the script in the future is going to wonder the >> same-z and -n > > > Some shells do not wo

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread Mladen Turk
On 07/17/2013 04:01 PM, sebb wrote: May I suggest a short comment is added to the script to document why -z and -n are not used? Someone else reading the script in the future is going to wonder the same-z and -n Some shells do not work well if variable is not set when using -z and -n. In case

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread sebb
On 17 July 2013 12:59, Mladen Turk wrote: > On 07/16/2013 11:42 PM, Christopher Schultz wrote: >> >> All, >> >> While doing the trivial fix for >> https://issues.apache.org/bugzilla/show_bug.cgi?id=55268, I noticed a >> few idioms being used in bin/daemon.sh that struck me as odd. For example: >>

Re: Various shell-scripting idioms in bin/daemon.sh

2013-07-17 Thread Mladen Turk
On 07/16/2013 11:42 PM, Christopher Schultz wrote: All, While doing the trivial fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=55268, I noticed a few idioms being used in bin/daemon.sh that struck me as odd. For example: while [ ".$1" != . ] do case "$1" in --java-home )

Various shell-scripting idioms in bin/daemon.sh

2013-07-16 Thread Christopher Schultz
All, While doing the trivial fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=55268, I noticed a few idioms being used in bin/daemon.sh that struck me as odd. For example: while [ ".$1" != . ] do case "$1" in --java-home ) JAVA_HOME="$2" shift; shift; conti