Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: daniel.j.botz@cummins.com (Dan)
Subject: Unexpected result from grep
Date: 11 Dec 2003 08:13:13 -0800	[thread overview]
Message-ID: <ffb05a35.0312110813.6e4e57ba@posting.google.com> (raw)

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


             reply	other threads:[~2003-12-11 16:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-11 16:13 Dan [this message]
2003-12-11 16:32 ` Unexpected result from grep Jens Schweikhardt
2003-12-11 16:37 ` Chris F.A. Johnson
2003-12-11 16:47 ` Stephane CHAZELAS
2003-12-11 18:24   ` Joseph Dionne
2003-12-12 13:19     ` Dan
2003-12-19 20:11     ` Peter da Silva
2003-12-20 16:13       ` Dan Mercer
2003-12-22 21:14         ` Peter da Silva
2003-12-23 16:01           ` Dan Mercer
2003-12-23 21:01             ` Peter da Silva
2003-12-23 22:15               ` Dan Mercer
2003-12-25 22:29                 ` Peter da Silva
2003-12-24 16:41       ` Stephane CHAZELAS
2003-12-25 22:15         ` Peter da Silva
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox