unix - Command passed as argument to shell script -


i want pass command shell script. command grep command. while executing getting following errors, please help:

myscript.sh "egrep 'error|fatal' \*20100428\*.log | grep -v astring" 

myscript.sh simple script:

#!/bin/ksh  cd log  $1 

the errors are:

egrep: can't open | egrep: can't open grep egrep: can't open -v egrep: can't open astring 

error because egrap sees |, grep, -v , astring arguments.

try this:

eval $1 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -