os:command queston

Raimo Niskanen raimo+erlang-questions@REDACTED
Tue Apr 6 11:37:12 CEST 2021


On Fri, Apr 02, 2021 at 07:35:50PM +0200, Dieter Schön wrote:
> addendum:
> 
> The error has nothing to do with the dot in oblivious.tex, it comes from 
> "before" the first tex:
> 
> If I change the first tex to hex:
> 
> 1> os:command(pdflatex --shell-escape hex/oblivious.tex).
> * 3: syntax error before: hex
> 
> If I try a valid parameter, erlang complains that os:command doesn't exist:
> 
> 5> os:command("ls").
> ** exception error: undefined function os:command/1
> 
> But in the case of the unquoted string pdflatex --shell-escape tex....
> 
> the erlang parser first tries to evaluate the function arguments
> 
> pdflatex is an atom,
> 
> --shell-escape probably parses to lists:subtract, atom, minus, atom
> 
> and the parser gives up.
> 
> Shouldn't it already complain when it cannot find command in module os?

The parser can not know that this is a function call until it has parsed up
to the terminating ')'.  It has parsed all tokens, and then tries to fit
them into the syntax.  It is probably looking for the terminating ')' but
runs into problems at the '.' after 'oblivious'.  A '.' is only allowed in
a floating point number or in a record reference.  'oblivious' is not the
start of a floating point number and is missing the '#' so it cannot be a
record reference.

So it has a '.' that can not be a terminating dot because there a ')' is
missing, and it can not be a floating point number nor a record reference.
In short, this is not according to syntax.

That the intention was to create an argument list for a function call is
not on the table yet.

/ Raimo Niskanen



> 
> 
> regards,
> 
> dieter
> 
> 
> 
> On 02.04.21 19:20, Dieter Schön wrote:
> > Hi Lloyd,
> >
> >
> > I think os:command doesn't exist. If I try this, I get the same error:
> >
> > 7> os:gargantua(pdflatex --shell-escape tex/oblivious.tex).
> >
> > * 1:38: syntax error before: tex
> >
> >
> > Have you tried
> >
> > > os:cmd("pdflatex --shell-escape tex/oblivious.tex").
> >
> > regards,
> >
> > Dieter
> >
> >
> > On 02.04.21 19:05, Lloyd R. prentice wrote:
> >> os:command(pdflatex --shell-escape tex/oblivious.tex).

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB


More information about the erlang-questions mailing list