bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash 2.05a isn't calling gawk as expected


From: Paul Jarc
Subject: Re: Bash 2.05a isn't calling gawk as expected
Date: Wed, 05 Jun 2002 17:33:05 -0400
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i686-pc-linux-gnu)

nparks@torah.org wrote:
> When I use bash 2.05a, each invocation of gawk produces an error msg
> saying that gawk cannot open a file named "-v".
...
>   tail session_log |
>     gawk -v Username=`basename $i` -v TodayDate=`date '+%b %e'` \
>       -v CurrentYear=`date '+%Y'` -v BlockFlag=$blockflag \
>       '$0 ~ /[Uu]ser/ && $0 !~ Username && $0 ~ TodayDate \
>       && $0 ~ CurrentYear \
>       {print Username, $0 >> BlockFlag}'  

To see the command line that results after word splitting, replace
this with:
  tail session_log |
   for arg in \
    gawk -v Username=`basename $i` -v TodayDate=`date '+%b %e'` \
      -v CurrentYear=`date '+%Y'` -v BlockFlag=$blockflag \
      '$0 ~ /[Uu]ser/ && $0 !~ Username && $0 ~ TodayDate \
      && $0 ~ CurrentYear \
      {print Username, $0 >> BlockFlag}'
   do echo "$arg"; done

I suspect you need to double-quote the command substitutions and
variable expansions.


paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]