bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Not to escape with -v and with ''


From: arnold
Subject: Re: [bug-gawk] Not to escape with -v and with ''
Date: Sun, 18 Nov 2018 12:44:25 -0700
User-agent: Heirloom mailx 12.4 7/29/08

Hello.

Peng Yu <address@hidden> wrote:

> Strings are escaped with -v. But I am not sure if this is necessary,
> as special characters can be taken using shell's capabilities.

This has been existing practice for decades. Also, not all shells
have the capabilities you're referring to.

> But disabling escape can make regex string input much easier. The only
> problem is that there may be compatibility issues. Is this behavior
> dictated by any official standard?
>
> $ awk -v x='\\' 'BEGIN { print x}'
> \
> $ mawk -v x='\\' 'BEGIN { print x}'
> \
> $ awk -v x='\t' 'BEGIN { print x}' | cat -t
> $ awk -v x=$'\t' 'BEGIN { print x}' | cat -t
> ^I

You can check; I believe so but don't remember for sure. In
any case, it's not going to change.

> Also, can single quote be supported so that strings are taken
> literally without interpreting escaping with backslash?

Absolutely not. Sorry.

Arnold

P.S. You may wish to consider moving to a more fluid language
for your work, such as Perl or Ruby.



reply via email to

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