1
votes

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: enter image description here

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 enter image description here

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

1
What is the script...?Shayki Abramczyk
My bad , thnx for the reminder , see EDITachahbar
@ShaykiAbramczyk any ideas ?achahbar
Maybe has something to do with the answer on this question?Matt
For future reference, it's rather easier to read and work with your error message(s) if you paste in formatted text instead of pasting an image.Edward Thomson

1 Answers

5
votes

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