Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I try to print out latex source code with

a2ps somefile.tex

I get error messages from egrep like

egrep: Das Ende des angegebenen Intervalls ist nicht gültig

which translates to "the end of the given interval is invalid." After that texi2dvia4ps tries to compile my tex file and fails. I can print other source code just fine. Any idea what's wrong?

Edit: jofels answer fixes the problem with egrep. a2ps still tries to compile my .tex file instead of pretty printing it as source code. Using

a2ps --delegate=no somefile.tex

stops it (partly) from doing so. Minor commands like \item or \phi are still interpreted instead of printed out as they are in the file.

share|improve this question
up vote 5 down vote accepted

The message (in English "egrep: Invalid range end") comes from a bug in a2ps.

Its /usr/bin/texi2dvi4a2ps shell script calls egrep wrongly:

Instead of

echo "$command_line_filename" | egrep '^(/|[A-z]:/)' >/dev/null \
|| command_line_filename="./$command_line_filename"

it should be

echo "$command_line_filename" | egrep '^(/|[A-Za-z]:/)' >/dev/null \
|| command_line_filename="./$command_line_filename"

As the bug is in a shell script, you can fix it easily by just editing the file.

The pattern checks if the filename is absolute (starts with an /, relevant on Unix-like systems) or starts with a drive name (e.g. C:, relevant only for Windows systems). Otherwise, the filename is prepended with ./.

Feel free to report this bug upstream or to the distribution you use.

share|improve this answer
What does it grep? If it is user input that would further limit to ASCII. – Runium May 2 '13 at 11:20
@Sukminder I have extended my answer. The actual pattern is not relevant for Unix-like systems. – jofel May 2 '13 at 11:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.