Gavin Smith wrote:
> It is not supposed to only run on GNU awk.  In fact, it should prefer
> awk to gawk.  I prefer not to run texindex with gawk because mawk is
> much faster.

OK.

> Do you have any idea why awk is saying there is a syntax error?
> 
> awk: syntax error near line 1
> awk: bailing out near line 1

It boils down to this invocation:

$ awk -v Invocation_name=./texindex -f ../../texindex/texindex.awk -- -version
awk: syntax error near line 1
awk: bailing out near line 1

This awk does not support the '-v' option:

$ awk
awk: Usage: awk [-Fc] [-f source | 'cmds'] [files]

$ awk -f ../../texindex/texindex.awk -- -version
awk: syntax error near line 39
awk: bailing out near line 39

Apparently it does not understand the 'function' keyword.

nawk (= /usr/xpg4/bin/awk [2]) and gawk (preinstalled as /usr/bin/gawk [3])
are alternatives which work.

Therefore, on this platform, instead of picking the 'awk' that is found
in $PATH, it is a better strategy to look for 'nawk' or 'gawk' in $PATH.

Bruno

[1] https://docs.oracle.com/cd/E18752_01/html/816-5165/awk-1.html
[2] https://docs.oracle.com/cd/E88353_01/html/E37839/awk-1.html
[3] https://docs.oracle.com/cd/E88353_01/html/E37839/awk-1g.html




Reply via email to