Re: Problem with export AWKPATH
am 29.03.2008 22:14:07 von Barry MargolinIn article
twf_cc
> Dear All,
>
> I have a problem with export gawk's enviroment var AWKPATH.
> I have some function place in ~/lib/awk, after export AWKPATH
> enviroment var, it is worked to call function from ~/lib/awk
> here is screen shot
> fang@bash ~
> $ tail -n6 ~/.bash_profile
> export NNTPSERVER='freenews.netfront.net'
> export LYNX_CFG="$HOME/lynx.cfg"
> export LESSCHARSET=latin1
> #export LC_CTYPE=zh_CN.gbk
> export CHARSET=GBK
> export AWKPATH="/usr/lib/awk:$HOME/lib/awk"
>
> fang@bash ~
> $ unset AWKPATH
>
> fang@bash ~
> $ echo $AWKPATH
>
>
> fang@bash ~
> $ source .bash_profile
>
> fang@bash ~
> $ echo $AWKPATH
> /usr/lib/awk:/home/fang/lib/awk
>
> fang@bash ~
> $ echo abcd | gawk -f reverse.awk --source '{print reverse($0)}'
> dcba
>
> fang@bash ~
> $ cat junk
> #! /bin/gawk -f reverse.awk --source
> {
> print reverse($0)
> }
>
> fang@bash ~
> $ echo abcd | ./junk
> gawk: fatal: can't open source file ` reverse.awk --source' for
> reading (No such file or directory)
>
> I got a error.....'
The error doesn't seem to have anything to do with AWKPATH, it's with
the way the shebang line is processed. It's treating "reverse.awk
--source" as a single argument.
Most systems have limits on the number of arguments that can be used in
a shebang line. Apparently on your OS, everything after that is treated
as a single argument.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE don't copy me on replies, I'll read them in the group ***