Shell – Error “syntax error near unexpected token `(‘?”

cshshell-scripttcsh

What's in my terminal

bash: settings64.csh: line 35: syntax error near unexpected token `('
bash: settings64.csh: line 35: `foreach i ( $xlnxInstLocList )'

Portion of the script

set xlnxInstLocList="${xlnxInstLocList} common"
set xlnxInstLocList="${xlnxInstLocList} EDK"
set xlnxInstLocList="${xlnxInstLocList} PlanAhead"
set xlnxInstLocList="${xlnxInstLocList} ISE"
set XIL_SCRIPT_LOC_TMP_UNI=${XIL_SCRIPT_LOC}
foreach i ( $xlnxInstLocList )

Location of syntactical error at the bottom

line 35
foreach i ( $xlnxInstLocList )

I'm not a scripter; I'm trying to fix an error in the scripting for my ISE DESIGN SUITE installation. I just need a quick set of code to replace "foreach i ( $xlnxInstLocList )" to perform its intended function. I think it's a Bash script.

Best Answer

Follow the actual installation instructions properly!

You buried this in a comment:

The environment variables are written to settings[32|64].(c)sh at "/opt/Xilinx/14.7/ISE_DS". To launch the Xilinx tools, first source the settings script:

C-shell 64 bit environment...
source /opt/Xilinx/14.7/ISE_DS/settings64.csh

This is just part of a larger set of unofficial instructions, and you did not read the whole thing properly. They continue on from that to say:

Shell, Bash shell, Korn Shell 64 bit environment...
. /opt/Xilinx/14.7/ISE_DS/settings64.sh

The actual instructions from Xilinx itself, as given in the "Linux installation" section of the installation guide, say:

1. Go to the XILINX installation directory

2. Type either source settings32.(c)sh or source settings64.(c)sh, as required for your shell.

As is apparent from your question, you are using the Bourne Again shell. So you should be sourcing the .sh file not the .csh file. Stop trying to fix the Xilinx script, which doesn't need fixing, and actually run the right script for your shell out of the set of scripts for different shells that Xilinx provides.

Further reading

  • "Linux Installation". Xilinx Design Tools: Installation and Licensing Guide. version 14.1. Xilinx. 2012-05-08. p. 6.
Related Question