Anything like this out there, which would not require me to run -shell-escape everytime - just in case I need to compile the same document on the machine that has earlier TexLive?

EDIT: this is what I meant - this should be the code in https://tex.stackexchange.com/a/191705/2595 , but with a conditional switch for Texlive2014; unfortunately it crashes with ! Undefined control sequence. l.50 ...\bbl@monogreek \bbl@monogreek=\l@monogreek:

Thanks for that @Aradnix - but that is the answer to exactly the same question I quoted; and I of course saw the answer. The thing is, I don't just want to delete from the code - I want to handle it depending on texlive version from inside pdflatex; I'd thus need a variable/command, which I can obtain by parsing a command line call, but that then requires -shell-escape, which I don't want; hence my question. Cheers!
– sdaauOct 8 '14 at 22:10

5

Why don't you test for the existence of the file \IfFileExists{lgrxenc.def}...? [Untested as you haven't provided an MWE.]
– cfrOct 8 '14 at 22:16

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) kpathsea version 6.2.0

on a vanilla TeX Live, but to

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014/Debian) kpathsea version 6.2.0

on Debian TeX Live (and similarly for other packaged distributions). The \gettexliveversion macro gets as its first argument everything up to (; #2 is TeX, #3 is Live, #4#5#6#7 is the year, #8 everything up to the ) and #9 is the rest. One might also use #8 for other purposes, so I left it there instead of gobbling everything after the year.

Here's a version which just tests for the existence of the encoding file and is therefore independent of the TL version etc. (I assume this should work with e.g. MiKTeX etc. as well. It would also work if you installed a local version of the encoding although I am by no means suggesting that doing so would be wise.)

\documentclass[a4paper,greek,british]{article}% or american note that the LAST specified language is default
\IfFileExists{lgrxenc.def}{%
\typeout{TexLive version is smaller than 2014, using LGRx} % probably better to change this to a more accurate message e.g. 'lgrxenc.def not found...'
\usepackage[LGRx,T1]{fontenc}%
}{%
\typeout{TexLive version is >= 2014, NOT using LGRx}%
\usepackage[T1]{fontenc}%
}
% \usepackage{xgreek}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\begin{document}
The starting verse of the Iliad is
\begin{quotation}\greektext
Μῆνιν ἄειδε, θεά, Πηληιάδεω Ἀχιλῆος
\end{quotation}
and it's really great.
\end{document}