Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* Unexpected result from grep
@ 2003-12-11 16:13 Dan
  2003-12-11 16:32 ` Jens Schweikhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Dan @ 2003-12-11 16:13 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2003-12-25 22:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-11 16:13 Unexpected result from grep Dan
2003-12-11 16:32 ` 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

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