Friday, January 6, 2023

How to solve script error $'\r': command not found syntax error: unexpected end of file

when trying to execute a script from root, like the following:
 su - oracle -c "/tmp/set_params.sh"
You may see errors like the following:
set_params.sh: line 6: $'\r': command not found
set_params.sh: line 42: syntax error: unexpected end of file
Root cause:

You have windows-style formatting in your file

Solution:
dos2unix set_params.sh
dos2unix: converting file flexpod_params.sh to Unix format...
When executed again, the above errors should be gone!

No comments:

Post a Comment