9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <forsyth@caldo.demon.co.uk>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] is there any good reason why awk does this?
Date: Mon,  1 Sep 2003 08:01:52 +0100	[thread overview]
Message-ID: <a98d6dc0c41630f475a04b6e73ff76f0@caldo.demon.co.uk> (raw)
In-Reply-To: <1ef339d30bfee33810aa4e1d0c4488af@sdgm.net>

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]

same reason as this, i suspect:

awk 'END {print 1 * "hello"}' /dev/null
0

the rules aren't really given in the manual page except perhaps
by implication in the BUGS, but in a context where a number is
expected (operand of arithmetic operator) the string is converted
to a number, and "hello" or "foo" are both zero, but "5hello" is 5.
exit takes an expression but doesn't say whether it's integer or
string (but it's integer, as usual on Unix).

[-- Attachment #2: Type: message/rfc822, Size: 1956 bytes --]

From: boyd@sdgm.net
To: 9fans@cse.psu.edu
Subject: [9fans] is there any good reason why awk does this?
Date: Sun, 31 Aug 2003 22:50:34 -0400
Message-ID: <1ef339d30bfee33810aa4e1d0c4488af@sdgm.net>

brahma% awk 'END {exit "foo"}' /dev/null ; echo $status

brahma% awk 'END {exit 1}' /dev/null ; echo $status
awk 8186: 1

  reply	other threads:[~2003-09-01  7:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-01  2:50 boyd
2003-09-01  7:01 ` Charles Forsyth [this message]
2003-09-01 13:53   ` boyd, rounin
2003-09-01 17:35     ` rob pike, esq.
2003-09-02  0:38       ` boyd, rounin
2003-09-01 17:41     ` Joel Salomon
2003-09-01 17:37       ` Dan Cross
2003-09-03  0:33         ` boyd, rounin
2003-09-03  8:48           ` Douglas A. Gwyn
2003-09-03  9:31             ` Lyndon Nerenberg
2003-09-03 12:20               ` boyd, rounin
2003-09-03 12:56                 ` Russ Cox
2003-09-03 21:19                   ` boyd, rounin
2003-09-03 22:15                   ` boyd, rounin
2003-09-03 13:30                 ` Ralph Corderoy
2003-09-03 21:18                   ` boyd, rounin
2003-09-08  9:09                     ` Ralph Corderoy
2003-09-08  9:53                       ` boyd, rounin
2003-09-03 12:08             ` boyd, rounin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a98d6dc0c41630f475a04b6e73ff76f0@caldo.demon.co.uk \
    --to=forsyth@caldo.demon.co.uk \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).