[erlang-questions] Command line and quotes

Bengt Kleberg bengt.kleberg@REDACTED
Wed Dec 6 09:10:53 CET 2006


On 2006-12-05 16:03, Pupeno wrote:
> Hello,
> I have a script that starts and stops my Erlang application fanterlasticfour, 
> the command to start is (in bash):
> 
>  "$RUN_ERL -daemon $PIPEDIR/ $LOGDIR/ \"$ERL -sname $NAME -boot 
> fanterlasticfour -config /usr/local/etc//fanterlasticfour/fanterlasticfour\""
> 
> and the command to stop is:
> 
>  "$ERL_CALL -sname $NAME -a \"init stop\""
> 
> Before running them, when in verbose mode, I echo them and I see:
> 
> run_erl -daemon /usr/local/var/tmp/fanterlasticfour/ /usr/local/var/log/fanterlasticfour/ "erl -sname 
> fanterlasticfour -boot 
> fanterlasticfour -config /usr/local/etc//fanterlasticfour/fanterlasticfour"
> 
> and
> 
> erl_call -sname fanterlasticfour -a "init stop"
> 
> respectively.
> Both fail.
> The first one fail silently but in the logs I see:
> 
> =====
> ===== LOGGING STARTED Tue Dec  5 14:56:59 GMT 2006
> =====
> -sname: 1: Syntax error: Unterminated quoted string
> 
> and the second fails with:
> 
> Illegal argument 'stop"'.
> 
> Any ideas what's going on here ?
> Thank you.

first a warning. it was many years ago that i did serious unix shell 
work. at the time bash was not invented.

but as a starting point: use ' and you will get the effect (i think) you 
desire for the stop command.

longer story:
the original unix shell will interpret the command line for you, before 
starting the program (erl_call). among other things it will look inside 
"". that way you can do:
echo "$HOME again"
and get something different from
echo '$HOME again'

which is why ' will not help you with the start command.

i can not remember any way of having a single multi word string as an 
argument from the old shell. there is no lists in the shell. you only 
have a string. that means you will have a big problem if you want 
arguments of multi word strings. see the discussion of why plan9 got a 
new shell for more information about that problem 
(http://cm.bell-labs.com/sys/doc/rc.html).


bengt
-- 
    EPO guidelines 1978: "If the contribution to the known art resides
    solely in a computer program then the subject matter is not
    patentable in whatever manner it may be presented in the claims."



More information about the erlang-questions mailing list