Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!julius.cs.uiuc.edu!rpi!fitz From: fitz@mml0.meche.rpi.edu (Brian Fitzgerald) Newsgroups: comp.unix.shell Subject: Re: Am I using old-AWK or new-AWK? Message-ID: Date: 5 Jan 91 00:52:58 GMT References: Organization: Rensselaer Polytechnic Institute, Troy NY Lines: 18 Nntp-Posting-Host: mml0.meche.rpi.edu In article 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