From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1012a6,f7f68e18cfb8d31b,start X-Google-Attributes: gid1012a6,public X-Google-Thread: fa528,f7f68e18cfb8d31b,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-12-11 08:13:13 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: daniel.j.botz@cummins.com (Dan) Newsgroups: comp.unix.shell,comp.unix.tru64 Subject: Unexpected result from grep Date: 11 Dec 2003 08:13:13 -0800 Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 192.158.61.141 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1071159193 17253 127.0.0.1 (11 Dec 2003 16:13:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 11 Dec 2003 16:13:13 +0000 (UTC) Xref: archiver1.google.com comp.unix.shell:3311 comp.unix.tru64:11024 Hello, I can't seem to figure out why this isn't working. I'm running it on Tru64 V5.1A with patch kit 5. I'm probably missing something obvious. :-( Here is my script: /tmp # cat search #!/usr/bin/ksh set -x typeset -r COMMAND='/sbin/grep' typeset -r EXPRESSION="${1}" typeset -r CHECK_FILE="${2}" typeset RESULT='' RESULT="$(${COMMAND} -E \'${EXPRESSION}\' ${CHECK_FILE} 2>/dev/null)" print "RESULT: ${RESULT}" Here is the test file: /tmp # cat afile rsh Here is what happens when I run the script: /tmp # search rsh afile + typeset -r COMMAND=/sbin/grep + typeset -r EXPRESSION=rsh + typeset -r CHECK_FILE=afile + typeset RESULT= + + /sbin/grep -E 'rsh' afile + 2> /dev/null RESULT= + print RESULT: RESULT: Yet if I run the command at the command line, I get this: /tmp # /sbin/grep -E 'rsh' afile rsh Thanks for your help! Dan