Problems with grep when used with echo
I am trying to run the below lines from within a perl script:
my $temp=`echo "DISPLAY QMGR DEADQ SCMDSERV SCHINIT" | runmqsc`;
print `$temp | egrep "QMGR|SCH"`;
But, I get an error saying:
sh: syntax error at line 1: `5724-H72' unexpected
The output when we run the above command from ksh will be:
bash-2.03$ echo "DISPLAY QMGR DEADQ SCMDSERV SCHINIT" | runmqsc
5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED.
Starting MQSC for queue manager NIMESU02.
1 : DISPLAY QMGR DEADQ SCMDSERV SCHINIT
AMQ8408: Display Queue Manager details.
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
Thanks for helping me!