pcksh: syntax error: `((' unexpected

  • 7021297
  • 06-Sep-2017
  • 06-Sep-2017

Environment

Privileged Account Manager 3.2
pcksh shell RUSH v1.2 (based upon pdksh-5.2.14-31)

Situation

Problem with "for" loop within pcksh shell
pcksh shell fails to execute a particular for loop structure while executing others fine:
# for((i=1;i<=10;i+=2)); do echo "Welcome $i"; done
pcksh: syntax error: `((' unexpected

Resolution

At the time of writing this document, the above example "for" loop syntax is unsupported in the pcksh shell, as it is also unsupported in the base pdksh-5.2 shell. This has been reported to Engineering for enhancement consideration. For more information on the progress of this enhancement, please contact Customer Care.

Alternative loop structures are certainly supported. Please refer to the pcksh man pages for supported and valid syntax. For example, the command mentioned in the Situation section above could be rewritten with the following while loop:
i=0; while [ $i -lt 10 ]; do echo "Welcome $i"; i=$(expr $i + 1); done

Cause

Unsupported "for" loop syntax in use based upon underlying pdksh shell.

Status

Reported to Engineering

Additional Information

The following will help determine the version of pcksh shell:

# echo $PCKSH_VERSION
@(#)RUSH v1.2 $Date: 2007-09-27 10:42:20 +0100 (Thu, 27 Sep 2007) $ (based up pdksh-5.2.14-31)

The following will help determine what shell is in currently in use:

# ps -p $$
  PID TTY          TIME CMD
  530 pts/1    00:00:00 pcksh

# echo $0
pcksh

Feedback service temporarily unavailable. For content questions or problems, please contact Support.