Configuration Information [Automatically generated, do not change]: Machine: i686 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -DCONF_VENDOR='pc' -DSHELL -DHAVE_CONFIG_H -D_GNU_SOURCE -I. -I. -I./include -I./lib -O2 -march=i386 -mcpu=i686 uname output: Linux acsvan0 2.4.18-4custom #3 Fri May 31 14:54:10 EDT 2002 i686 unknown Machine Type: i686-pc-linux-gnu
Bash Version: 2.05a Patch Level: 0 Release Status: release Description: A shell script which worked perfectly using "1.14.7(1)" fails to execute properly using "2.05a.0(1)-release". The purpose of the script is to parse a session log file found in each user's home directory, and determine whether a record belonging to some other user appears with today's date in the file. The parsing is done by gawk, using variables passed to it by repeated use of the "-v" parameter. I have tried this with both gawk 3.0.6 and gawk 3.1.1, and I get the same results with either gawk. When I use bash 1.14, bash calls gawk correctly and gives it the proper parameters. When I use bash 2.05a, each invocation of gawk produces an error msg saying that gawk cannot open a file named "-v". Repeat-By: Create files named "session_log" in the home directories of some users, and run the script. The shell script follows: .....cut here..... #!/bin/sh blockflag=/ihome/tables/modemhog.txt pageflag=/ihome/tables/modemhog.page [ -s $blockflag ] && exit for i in /home/* do [ -d $i ] || continue cd $i [ -f session_log ] || continue 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}' done [ -s $blockflag ] || exit 0 cat $blockflag cp -f $blockflag $pageflag .....cut here..... NEIL PARKS Beachwood, Ohio