Syntax Error Near Unexpected Token

0 Likes

When running a UNIX script (for example acuxdcbs.sh) the user may encounter the “syntax error near unexpected token” error.

Problem:

When running a script in either a Linux or UNIX environment, the user may encounter the “syntax error near unexpected token” error. Example:

$ acuxdbcs.sh -start
/acucobol810/bin/acuxdbcs.sh: line 50: syntax error near unexpected token `'
/acucobol810/bin/acuxdbcs.sh: line 50: `show_usage ()'

Resolution:

This is typically caused by editing the file on Windows, or if the file is transferred in binary mode rather than ASCII. Run the dos2unix command on the script and then rerun the script.

Example.

$dos2unix acuxdbcs.sh
dos2unix: converting file acuxdbcs.sh to UNIX format ...

Incident Number: 2277959

Old KB# 14294
Comment List
Related
Recommended