[Top][All Lists]

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

[bug-gawk] Debugging Script

From: Holger Klene
Subject: [bug-gawk] Debugging Script
Date: Sat, 6 Apr 2019 20:13:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1


I had to learn the hard way, that debugging requires a script file [1].

So I tried being clever and thought I run this in bash:

$ printf "%s\n" a b c \
 | gawk -f <(echo '{ if ($1 == "b") { print "great" } }')

From bash man page [2]:
> Process substitution allows a process's input or output to be referred
to using a filename.

Well so far it works great. But on adding -D to start debugging, I get
an error requesting option -f ... somehow gawk caught me cheating :-(

Now I have to "enhance" my bash-script to write a temp file at runtime.
This way I can keep my awk script (< 20 lines) embedded in context with
the surrounding bash script. But the necessary code looks really ugly
and in addition, I cannot easily toggle a comment somewhere to switch
off debugging *AND* writing the file at the same time.

My questions:
a) I don't get where my error is? Why doesn't my "workaround" just work?
b) Is there a bug tracker on this known limitation [1]? What's the plan?
Somebody working on it? ETA? How hard can it be to keep a few lines of
script in memory?

Thanks for your support

[1] https://www.gnu.org/software/gawk/manual/html_node/Limitations.html

|_|/ MfG
| |\ Holger Klene

PGP Key ID: 0x22FFE57E

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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