Reputation: 991
I tried to run a bash script through the bash script task inside Azure DevOps.
When my bash script was still small I always used the inline type and runned the code there. After my script became larger than 5000 characters I was forced to use the path type. But got some errors when using the path type:
After some debugging trying to find out where the hosting agent is fooling me. If i use the same script of 5000 character with the inline type and with the path type it works with the inline type but not with the path type which got me thinking it's about my settings not with the code itself.
This is my setting with path type
Even when i give a path after all it's a path type
in the "Script path" parameter it gave me the same error. Is there a setting I forget to set. Or do i do something wrong by just copy pasting the inline script inside a file ?
[EDIT] The script that is running is: https://paste.ee/p/XGY7Z
Upvotes: 1
Views: 1092
Reputation: 78743
Looks like a newline issue:
/home/vsts/work/1/s/CheckAlerts.sh: line 6: declare: `arrReportsFailed
': not a valid identifier
Note the newline in the middle of the error message. Similarly:
/home/vsts/work/1/s/CheckAlerts.sh: line 13: syntax error near unexpected token `$'do\r''
Note the \r
.
bash doesn't cope with Windows-style (CRLF) line endings. Change your file to have Unix-style (LF) line endings. Enforce this with a .gitattributes
:
*.sh text eol=lf
Upvotes: 5