Piped shell \input
Philip Taylor (Hellenic Institute)
P.Taylor at Hellenic-Institute.Uk
Tue Jun 21 19:35:55 CEST 2022
On 21/06/2022 17:54, Andreas Scherer wrote:
> Dear TeX hackers,
>
> Do you see any chance to replace this working (!) example
>
> [snip]
>
> with the desired compact version
>
> \newcount\countD \countD=0
> \ifpdftex \ifnum\pdfshellescape=1
> \countD=\input{|"grep \\\\:\\\\X \jobname.tex | wc -l"} \fi\fi
Is not your fundamental problem that \\, \\\\, etc., are not TeX escape
sequences ? If I were you, I would create a new TeX escape character
(e.g., !), then re-catcode \ such that it does not require escaping.
Something along the lines of :
\newcount \countD
\countD = 0
\ifpdftex
\ifnum \pdfshellescape = 1
\begingroup
\catcode `\! = \catcode `\\
\catcode `\\ = \catcode `\@
!global !countD = !input {|"grep \\\\:\\\\X !jobname.tex |
wc -l"}
\endgroup
\fi
\fi
E & OE, of course.
--
/Philip Taylor/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20220621/8a9bd10d/attachment.html>
More information about the texhax
mailing list.