Hi Ravi,
I suspect this is a line-ending issue:
bash: line 75: syntax error near unexpected token `$'do\r''
This looks like the bash script has Windows-style line endings (separate carriage-return and line-feed characters), but the remote host's Bash interpreter is expecting Unix-style line endings (a single newline character).
This can happen if you are using a Windows text editor to create your Bash files. Some editors have settings where you can customize when the editor should use Windows-style and when to use Unix-style (e.g. by extension). If you're using a Windows editor that does NOT have such an option, you'll need to convert the endings using some other method (there are standalone tools, and some source control systems will do this automatically)
------------------------------
Tom Walsh
Software Engineer
Delphix
------------------------------
Original Message:
Sent: 08-07-2020 07:47:53 AM
From: Ravi Nistala
Subject: Issue with Bash script
how to write a for loop in bash script.We have a bashscript with functions inside them. as shown below.
for sn in "$DBSERVERNAMES"
do
......
done
The above works outside fine but when run inside delphix giving the following error.
/u01/app/toolkit/Delphix_COMMON_e6ae29ec_ab51_2431_7fb5_0b01581f2a9c_informix_host/scripts/bash/linux_x86/bin64/bash: line 75: syntax error near unexpected token `$'do\r''
Along the same lines can we write functions inside a bash script ?
thanks
Ravi.N
------------------------------
Ravi Nistala
Community Member
TDGlobal
------------------------------