I cannot use the hashtag character in my bash command in gitlab as it is the character that signal that a comment start there.
IntelliJ seems to indicate that going for a double hashtag ‘##’ would work, but it doesn’t work. Gitlab sees a comment in the middle of the command regardless.
No luck with backslash either ‘#’. Gitlab does not see the hashtag character as a comment starter anymore, but will use the backslash along with the hashtag.
Just print the hashtag with the backslash in a variable and then remove the backslash from the string. It is cheap, but it works.
- HASH=$(echo "#")
- HASH="${HASH:1}"
- echo $HASH