I am trying to test the thread answer here about Inputting multiple files in LaTeX but I get the following error about file being empty. I need to have documentclass article which should be ok as in the documentation here.
\documentclass{article}
\usepackage{bashful} % https://tex.stackexchange.com/a/13943/13173
\begin{document}
%https://tex.stackexchange.com/a/13943/13173
\bash[stdoutFile=inputs_ls.tex]
{ ls *.jpg | sort -n }
\END
\input{inputs_ls.tex}
\end{document}
Output
L10: File inputs_ls.texwas empty
after EOF
L10: bashStdout :=
\bashStdout
L10: Closing file inputs_ls.tex
L10: Defining macro for the contents of the standard error file
L10: Opened file test.input.bash.stderr
L10: File inputs_ls.texwas empty
! Undefined control sequence.
<write> ...nputlineno : bashStderr :=
\bashStderr
l.10 \END
^^M
?
Testing egreg's solution again
Using absolute path
\documentclass{article}
\usepackage{bashful} % https://tex.stackexchange.com/a/13943/13173
\begin{document}
%https://tex.stackexchange.com/a/13943/13173
\bash[stdoutFile=inputs_ls.tex]
ls /home/masi/Documents/Images/*.jpg | sort -n
\END
\input{inputs_ls.tex}
\end{document}
Output
\everyMPtoPDFconversion=\toks18
)
\c@lstlisting=\count103
\openout3 = `test.input.bash.sh'.
runsystem(bash -c "bash test.input.bash.sh >inputs_ls.tex 2>test.input.bash.std
err || echo $? >test.input.bash.exitCode")...disabled (restricted).
\openout3 = `test.input.bash.sh'.
L10: I will now print the contents of file test.input.bash.stderr (if found)
L10: File test.input.bash.stderr was empty
L10: Proceeding as usual
L10: Checking whether any listings are required
L10: Nothing has to be listed
L10: Defining macro for the contents of the standard output file
L10: Opened file inputs_ls.tex
L10: File inputs_ls.texwas empty
after EOF
L10: bashStdout :=
\bashStdout
L10: Closing file inputs_ls.tex
L10: Defining macro for the contents of the standard error file
L10: Opened file test.input.bash.stderr
L10: File inputs_ls.texwas empty
! Undefined control sequence.
<write> ...nputlineno : bashStderr :=
\bashStderr
l.10 \END
^^M
? X
Here is how much of TeX's memory you used:
3434 strings out of 493013
48381 string characters out of 6133327
110335 words of memory out of 5000000
6992 multiletter control sequences out of 15000+600000
3640 words of font info for 14 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
33i,0n,37p,233b,219s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.
PDF statistics:
0 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
Run the command with pdflatex -shell-escape ... and it works.
No errors. Confirmed.
TeXLive: 2016
OS: Debian 8.5
Engine: pdflatex, tested also xelatex
shell-escape? but really it's simpler just to do the ls before you start tex, there is no reason to make tex start an external process to make the file listing – David Carlisle Dec 23 '16 at 11:57...disabled (restricted)means you didn't runpdflatex(or whatever) with-shell-escape. – egreg Dec 23 '16 at 12:13