Skip to content

Instantly share code, notes, and snippets.

@wwalker
Last active July 14, 2020 16:44
Show Gist options
  • Save wwalker/6f5fc14f33caba5b21ac3ecdfb00ba8a to your computer and use it in GitHub Desktop.
Save wwalker/6f5fc14f33caba5b21ac3ecdfb00ba8a to your computer and use it in GitHub Desktop.
shellcheck how to disable a small scope

I need to ignore these 3 lines without ignoring everything after them. I've tried this, but, as expected, it ignores to the end of the file:

# shellcheck disable=SC2086
# shellcheck disable=SC2139
alias foralldo='for i in '$envs'; do echo "******************************"; echo "$i";'
alias formostdo='for i in '$dcmost'; do echo "******************************"; echo "$i";'
alias forproddo='for i in '$dcprod'; do echo "******************************"; echo "$i";'

So then I tried this, but it only ignores 1 line

  222 {
  223   # shellcheck disable=SC2086
  224   # shellcheck disable=SC2139
  225   alias foralldo='for i in '$envs'; do echo "******************************"; echo "$i";'
>>226   alias formostdo='for i in '$dcmost'; do echo "******************************"; echo "$i";'
>>227   alias forproddo='for i in '$dcprod'; do echo "******************************"; echo "$i";'
  228 }

aliases.sh|226 col 30 warning| This expands when defined, not when used. Consider escaping. [SC2139]
aliases.sh|226 col 30 warning| Double quote to prevent globbing and word splitting. [SC2086]
aliases.sh|227 col 30 warning| This expands when defined, not when used. Consider escaping. [SC2139]
aliases.sh|227 col 30 warning| Double quote to prevent globbing and word splitting. [SC2086]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment