NEDIT + Red Hat Issue

freeslkr freeslkr.wl6x at mailnull.com
Wed Apr 19 18:30:22 UTC 2006


Ian Pilcher <i.pilcher <at> comcast.net> writes:

> Save the following script as /usr/local/bin/nedit:
> 
>   #!/bin/bash
>   LANG=${LANG%.UTF-8} exec /usr/bin/nedit ${1+"$ <at> "}
> 
> And make it executable (chmod 0755 /usr/local/bin/nedit).
> 
> BTW, I'd really appreciate it if someone could explain the '${1+"$ <at> "}'
> brace expansion.  It's the only way I've found to handle multiple
> parameters, some of which contain spaces, but I'd love to know *why* it
> works.

Replacing ${1+"$@"} with "$@" also works in this case; though there
are other situations where you'd need to use the ${1+"$@"} construct.
${1+<something>} tests $1 to see if it is defined. If it isn't the
whole construct is replaced with nothing.  If it is, the whole
construct is replace with <something>. "$@" expands to the list of
positional parameters, quoted so that whitespace is preserved. See the
PARAMETERS and EXPANSION sections of the bash manual for details.

freeslkr




More information about the fedora-list mailing list