// AIX 6.1
I am getting a syntax error below. Please advise what to be corrected.
runmqsc CERN.$(echo `hostname` | cut -d'.' -f1 | tr '[:lower:]' '[:upper:]').$(echo $environment | tr '[:lower:]' '[:upper:]') <<! | egrep -i '(FROM.NC.APPLIANCE)' | sort -u |awk '{print $2}' | cut -d '(' -f2 | cut -d ')' -f1 | while read line; do dig -x $line +short; done; dis qstatus(cern.ssreq.security) type(handle) all
!
-bash: syntax error near unexpected token `('
Making lots of assumptions and having no idea why you have an empty here-document feeding data into a tr
command that is also reading from a pipeline nor why you think you need a case insensitive search while using egrep
on input that has already been converted to uppercase only by two preceding tr
commands, you might want to try:
runmqsc "CERN.$(echo `hostname` | cut -d'.' -f1).$(echo "$environment")" |
tr '[:lower:]' '[:upper:]' |
egrep '(FROM.NC.APPLIANCE)' |
sort -u |
awk '{print $2}' |
cut -d '(' -f2 | cut -d ')' -f1 |
while read line
do dig -x "$line" +short
done
dis 'qstatus(cern.ssreq.security)' 'type(handle)' all
This assumes that you don't want to convert tabs and sequences of one or more spaces and tabs in the expansion of $environment
to single spaces and that the first character of the expansion of $environment
is not a minus sign immediately after any leading spaces and tabs have been removed. I also assume that there are backslash escape sequences embedded in the expansion
of $environment
or you would have just used:
$envionment
instead of:
$(echo $environment)
and that you are using a version of bash
on a system where echo
expands backslash escapes by default.