Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: Jens Schweikhardt <usenet@schweikhardt.net>
Subject: Re: Unexpected result from grep
Date: 11 Dec 2003 16:32:50 GMT	[thread overview]
Message-ID: <bra67i$kdr$1@newsfeed.pit.comms.marconi.com> (raw)
In-Reply-To: ffb05a35.0312110813.6e4e57ba@posting.google.com

In comp.unix.shell Dan <daniel.j.botz@cummins.com> wrote:
# 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)"

For EXPRESSION=foo, this will grep for 'foo', *including* the single
quotes. You need to eval the string to have the single quotes be
interpreted.

RESULT="$(eval ${COMMAND} -E \'${EXPRESSION}\' ${CHECK_FILE} 2>/dev/null)"

Should do the trick.

Regards,

	Jens
-- 
Jens Schweikhardt  http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)


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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-11 16:13 Unexpected result from grep Dan
2003-12-11 16:32 ` Jens Schweikhardt [this message]
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