1

I would like to do something like this:

\immediate\write18{git log -1 --pretty=format:"%h-%ad" --date=short > /tmp/temp.dat }

however, xelatex cannot proceed because the % means comment out if I do this:

\immediate\write18{git log -1 --pretty=format:"\%h-\%ad" --date=short > /tmp/temp.dat }

The call is actually:

git log -1 --pretty=format:"\%h-\%ad" --date=short > /tmp/temp.dat

which will have extra \ in it.

How can I let the shell command use % instead of \% ?

Wang
  • 173
  • See http://tex.stackexchange.com/questions/34390/how-can-i-write-into-a-file for example – Joseph Wright Jan 14 '15 at 12:18
  • it did not work, I think it is only for writing stuff not shell escape? I got \spacefactor \@m {}percentchar h;\spacefactor \@m {}percentchar ad – Wang Jan 14 '15 at 12:24
  • You need \makeatletter ... \makeatother around code using \@percentchar: http://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do – Joseph Wright Jan 14 '15 at 12:26
  • thanks, I am using \catcode`\%=11 \catcode`\%=14 pair now. – Wang Jan 14 '15 at 12:29

0 Answers0