[erlang-questions] Re: how do I get the actual list of arguments passed to an escript?
Raimo Niskanen
raimo+erlang-questions@REDACTED
Tue Apr 5 16:45:57 CEST 2011
On Mon, Apr 04, 2011 at 05:27:34PM +0200, Matthias Lang wrote:
> Problem solved.
>
> TLDR: I outsmarted myself with a collection of symlinks and a broken
> shell script.
:
> 3. The first 'erl' in my path is a shell script to an older Erlang:
>
> #!
> /usr/local/src/otp_src_R14B01/bin/erl $@
>
> That's probably a left-over from some debugging effort.
>
> 4. The $@ variable in BASH is subject to "word splitting", but that
> can be disabled by writing "$@", which is equivalent to "$1" "$2" "$3" ...
>
> It feels like #3 and #4 ganged up to trick me... Without having thought
> it through much, I can't see why $@ doesn't always behave like "$@"
> (why would you want to word expand all arguments? By default?!).
What you acually want is ${1+"@"} since "$@" when there are no arguments
expands to "" i.e one empty argument. ${1+"$@"} expands "$@" iff
there is at least one argument, empty or not.
--
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list