Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!exodus!ichthous.Eng.Sun.COM!mcgrew From: mcgrew@ichthous.Eng.Sun.COM (Darin McGrew) Newsgroups: comp.unix.questions Subject: Re: Shell/gawk interaction Keywords: Bourne shell, awk Message-ID: <4500@exodus.Eng.Sun.COM> Date: 13 Dec 90 23:21:33 GMT References: <247@locke.water.ca.gov> Sender: news@exodus.Eng.Sun.COM Organization: Sun Microsystems, Mt. View, Ca. Lines: 23 rfinch@caldwr.water.ca.gov (Ralph Finch) writes: >I do not understand why the following bourne shell script generates an >error in the awk program: The whitespace in $args is not being quoted, which causes the gawk program argument to be broken up into several arguments. The following should work better-- #!/bin/sh filename=$1 ; shift nargs=$# args="$*" echo $args gawk ' BEGIN { args="'"$args"'" print args exit }' $filename Darin McGrew mcgrew@Eng.Sun.COM Affiliation stated for identification purposes only.