Thread View: comp.unix.shell
2 messages
2 total messages
Started by James Brister
Fri, 04 Jan 1991 00:25
Am I using old-AWK or new-AWK?
Author: James Brister
Date: Fri, 04 Jan 1991 00:25
Date: Fri, 04 Jan 1991 00:25
11 lines
938 bytes
938 bytes
Suppose I want to call AWK from a shell script, but I need the new version
of AWK. Is there a little AWK script that will tell me what version I'm
using in a "decent" manner (i.e. doesn't just break if run under the old
version).
Thanks
James
--
James Brister brister@decwrl.dec.com
DEC Western Software Lab., Palo Alto, CA {uunet,sun,pyramid}!decwrl!brister
Re: Am I using old-AWK or new-AWK?
Author: Brian Fitzgerald
Date: Sat, 05 Jan 1991 00:52
Date: Sat, 05 Jan 1991 00:52
18 lines
1057 bytes
1057 bytes
In article <BRISTER.91Jan3162556@westworld.decwrl.dec.com> brister@decwrl.dec.com (James Brister) writes:
>Suppose I want to call AWK from a shell script, but I need the new version
>of AWK. Is there a little AWK script that will tell me what version I'm
>using in a "decent" manner (i.e. doesn't just break if run under the old
>version).
If ARGC (argument count) is not predefined in your "old awk", try the
following:
#!/bin/sh
if awk 'BEGIN{ if (ARGC == 0 ) exit 0 ; exit 1 }'
then
echo "Bad awk version" >&2
exit 1
fi
... rest of shell script
Brian Fitzgerald
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads