Re: NEDIT + Red Hat Issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux