Tag Info

New answers tagged

6

You want \space instead of \  or instead of the braces. Braces are unexpandable tokens which means they're not removed in \write18. \  is an unexpandable primitive which again means it is not removed (or rather: expanded) in \write18. \space on the other hand is an expandable macro which expands to a space. \documentclass{article} ...


5

The following MWE show how you can directly \input from, say, the date command. It also shows how to \read the output of date in a control sequence, by means of \openin. \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \newread\teststream \newcommand*\testline{} \openin\teststream=|date \ifeof\teststream \typeout{Unable to open test stream.} ...


6

A very elementary approach: Write the script execution state (either of the script itself or of the last command to an external file using > redirection and then read this generated file to a \def\foomacro. \documentclass{book} \newread\myscriptresult \begin{document} \immediate\write18{./myscript.sh; echo $? > scriptresult.txt} ...



Top 50 recent answers are included