9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] awk(1): quote argument for -v option
@ 2022-11-29 12:10 Anders Damsgaard
  2022-11-29 13:47 ` qwx
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Anders Damsgaard @ 2022-11-29 12:10 UTC (permalink / raw)
  To: 9front

Dear all,

Running awk from rc, I found that I need to quote the arguments to awk's
-v option, as in:

	awk -v 'myvar=asdf' 'BEGIN{print myvar}'

However, the awk man page specifies this without quotes as "awk -v
myvar=asdf".  I now realize that it will not work without quotes because
rc tries to interpret the assignment operator.

Is this just a beginner mistake, being used to unix behavior, or worth
documenting as in the patch below?

Thanks, Anders


diff ff2ebe6cfdacd890a74a6d2f9b0acd062d2633b7 uncommitted
--- a/sys/man/1/awk
+++ b/sys/man/1/awk
@@ -23,7 +23,7 @@
  ]
  [
  .B -v
-.I var=value
+.I 'var=value'
  ]
  [
  .B -f
@@ -58,13 +58,13 @@
  Any
  .IR file
  of the form
-.I var=value
+.I 'var=value'
  is treated as an assignment, not a file name,
  and is executed at the time it would have been opened if it were a file name.
  The option
  .B -v
  followed by
-.I var=value
+.I 'var=value'
  is an assignment to be done before the program
  is executed;
  any number of

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-29 19:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 12:10 [9front] [PATCH] awk(1): quote argument for -v option Anders Damsgaard
2022-11-29 13:47 ` qwx
2022-11-29 14:52 ` Stanley Lieber
2022-11-29 15:14 ` Kurt H Maier
2022-11-29 15:22   ` Stanley Lieber
2022-11-29 16:24   ` Sigrid Solveig Haflínudóttir
2022-11-29 16:28     ` Jacob Moody
2022-11-29 16:43       ` Kurt H Maier
2022-11-29 19:06         ` Stanley Lieber
2022-11-29 19:52           ` Stanley Lieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).