How to execute .sh file in gitlab-ci.yml

I trying to execute .sh file in gitlab-ci.yml with command

- bash ./updateReportScript.sh

but it throw updateReportScript.sh: line 4: syntax error near unexpected token $‘in\r’’`
I tried to convert the line separator to different format ( LF - CRLF) but still got the problem.
I’m running gitlab runner in shell and on Windows machine.

Hi,

You can try to install and use dos2unix package to make sure there are no problems with formatting of LF/CRLF. But if it still happens, then perhaps there is rather more a problem with the script, so we would need to see entire script to see what the problem might be.

Hi,

I have also tried dos2unix, also some convert tool like notepad++ or using convert from IDE but not a chance.
Here is my script:

I’m just wondering based on the error, that it found a inside a token value, which to bash would look like it's attempting to push out a variable value. Normally if that is the case, the sign would need to be escaped to show the actual $ sign instead of attempting to changing it for a variable that’s non-existent. Or potential other invalid/problematic characters in that token.

In terms of script formatting, looks perfectly fine.

Sorry I don’t get what you mean. I have try to execute and passed variables locally without using gitlab ci and it work perfectly fine.