Shell Script Unexpected end of file
search cancel

Shell Script Unexpected end of file

book

Article ID: 41014

calendar_today

Updated On:

Products

CA Release Automation - Release Operations Center (Nolio) CA Release Automation - DataManagement Server (Nolio)

Issue/Introduction

Problem:

While using the "Run Command Line" action to run a shell script it is returning:

Run Command Line action has failed.

Return value: ...
Std out:
Std err: /path/to/shellscript.sh ... line <#>: syntax error: unexpected end of file

 

Environment:  

CA Release Automation 5.5.2 Server

CA Release Automation Agent on Unix/Linux

 

Cause: 

The shell script was saved on Windows and copied to the Unix/Linux agent machine. The problem with this is that Windows uses CR LF (carriage return & line feed) to handle new lines while Unix/Linux uses LF.  This can usually be seen by using the command:

cat -vet /path/to/shellscript.sh

and observing the ^M characters at the end of each line.  

 

Resolution:

Remove the carriage return characters from the shell script (using dos2unix or some other tool) before using the "Run Command Line" action. 

 

 

Environment

Release:
Component: RAAGT