I'm trying to call pdflatex
from a guile scheme file. This is the Guile command I'm using:
(system*
"cat" "foo.txt" "|" "pdflatex" "-jobname" "\"bar\"")
This is the error I get back after running the file:
cat: invalid option -- 'j'
Try 'cat --help' for more information.
If I run the command from bash shell it runs normally.
cat foo.txt | pdflatex -jobname "bar"
-jobname
is the correct command for pdflatex
, but system*
seems to have a problem with it.
I'm using (GNU Guile) 2.2.4 and pdfTeX 3.14159265-2.6-1.40.20.
Use system
, not system*
. It takes a single string as the argument, and executes it using the shell, which will perform the desired piping.
(system "cat foo.txt | pdflatex -jobname 'bar'")
system*
doesn't use the shell. As the manual explains:
system*
is similar to system, but accepts only one string per-argument, and performs no shell interpretation. The command is executed using fork and execlp. Accordingly this function may be safer than system in situations where shell interpretation is not required.
Note that your command is a Useless use of cat
since pdflatex
takes the filename as an argument. You could use system*
to execute it directly.
(system* "pdflatex" "-jobname" "bar" "foo.txt")
Also, you don't need to add extra quotes around bar
when you use system*
; since it doesn't use the shell, it doesn't parse special characters.