bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SLES12: awk hat Probleme mit bestimmtem Dateinamen


From: Andrew J. Schorr
Subject: Re: SLES12: awk hat Probleme mit bestimmtem Dateinamen
Date: Wed, 15 Jul 2020 12:43:26 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jul 15, 2020 at 03:59:45PM +0200, Ulrich Windl wrote:
> This is a bug report/feature request for GNU Awk 4.1.0, API: 1.0:
> 
> The issue basically is: "when is a filename considered to be a variable 
> assignment?"
> The manual basically says: "If a filename on the command line has the form 
> var=val it is treated as a  variable  assignment."
> 
> I had the problem that awk did read from stdin when it was expected to read 
> the file "cn=config/olcDatabase={1}hdb.ldif".
> Agreed, it's an odd file name.
> 
> Using option --lint did not bring any kind of warning, but when using 
> "./cn=config/olcDatabase={1}hdb.ldif" as file parameter instead, awk red the 
> file.
> 
> So I see three possible options:
> 1) Improve the documentation when a filename is treated as variable 
> assignment. Specifically add a note for option "-v" that the "-v" is actually 
> optional. Also note that a name containing a '=' anywhere makes it a variable 
> assignment, while a name starting with "./" is not a variable assignment 
> (obviously).
> 2) Improve --lint to add a warning like "parameter is treated as variable 
> assignment"
> 3) Generally emit a warning of a variable assignment is done withoput option 
> "-v"

This is not a direct answer, but I think that the -E option can be used
(instead of -f) to disable the interpretation of subsequent arguments as
variable assignments. It might be nice if there were a flag to accomplish
the same thing without requiring a file argument. From the man page:

       -E file
       --exec file
              Similar to -f, however, this is option  is  the  last  one  pro‐
              cessed.   This should be used with #!  scripts, particularly for
              CGI applications, to avoid passing in options or source code (!)
              on  the  command line from a URL.  This option disables command-
              line variable assignments.

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]