Eric Iverson wrote:
> I'm not familiar with the bash syntax you are using. 

Google finds me:

http://vertigo.hsrl.rutgers.edu/ug/shell_help.html

Skip down to "Conditional Reference"

(And note that none of this is specific to bash --
this has been bourne shell syntax since long before 
bash was written.)

> I assume the intent is to use JPATHj601 if defined 
> and !/j601 if not. Could you please explain what 
> is going on.

$name is /bin/sh shorthand to reference a variable

${name} is standard /bin/sh syntax to reference a variable

${name-value} is /bin/sh syntax to reference a variable 
and use value if the name is undefined.

Also note that "$@" is standard shell syntax to reference
command line parameters without breaking on whitespace
within those parameters.  In contrast, $* breaks apart
any parameters which contain whitespace.

None of the above is bash specific -- this has been 
part of shell syntax since long before bash was written.
Bash (and, I believe, any POSIX version of /bin/sh) also 
supports an equivalent ${name:-value} syntax.

If you have cygwin man pages installed, from the
cygwin shell try:

man ash
/:-

(In other words, search for :- on the manual page
for ash -- the BSD /bin/sh.)

> If this works as you indicate it is a nice improvement 
> and will be included in the release.

If you want to experiment with the above, I recommend
using parenthesis.  Parenthesis fork another copy of
the shell, so variable assignments are termporary.

(echo ${X-0})
(X=1; echo ${X-0})

The best way to illustrate "$@" is with a for loop

(set "a b c" "d e"; for x in "$@"; do echo ".$x."; done)
(set "a b c" "d e"; for x in $*; do echo ".$x."; done)

I hope this helps.

-- 
Raul

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to