Home > front end >  AIX Ksh grep script issue
AIX Ksh grep script issue

Time:05-02

I have this script that I had help with basically grep from specific file

It worked on RHEL 8 with Ksh but at my work with AIX 7.1 Doesn't work.

Gives me this error: 0404-057 Syntax error at line 6 : '(' is not expected

My script:

#!/use/bin/ksh
If [[ $# -eq 0]];
Then
Echo"add value please"
Else
For ((I = $#; I > 0; i--)); do
Grep -w -- "$1" responselist.lst || echo "'$1' not found"
Shift
Done
Fi

CodePudding user response:

Suggesting to try:

#!/use/bin/ksh
if [[ "$#" -eq 0 ]]; then
  echo "add value please"
else
  for ((i = $#; i > 0; i--)); do
    grep -w "$1" responselist.lst || echo "$1 not found"
    Shift
  done
fi

CodePudding user response:

Thanks to @shawn for the answer.

The issue was the version

This worked

/usr/bin/ksh93

  • Related