Skip to content

Commit

Permalink
debug: add some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Apr 17, 2024
1 parent 9adad91 commit acc541e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# Quoting
# =======

# echo $1 # Unquoted variables
echo $1 # Unquoted variables

Check warning

Code scanning / shellcheck

SC2086 Warning documentation

Double quote to prevent globbing and word splitting.
# rm "~/my file.txt" # Quoted tilde expansion
# v='--verbose="true"'; cmd $v # Literal quotes in variables
# touch $@ # Unquoted $@
# echo 'Path is $PATH' # Variables in single quotes
touch $@ # Unquoted $@

Check failure

Code scanning / shellcheck

SC2068 Error documentation

Double quote array expansions to avoid re-splitting elements.
echo 'Path is $PATH' # Variables in single quotes

Check warning

Code scanning / shellcheck

SC2016 Warning documentation

Expressions don't expand in single quotes, use double quotes for that.
# trap "echo Took ${SECONDS}s" 0 # Prematurely expanded trap
# unset var[i] # Array index treated as glob
unset var[i] # Array index treated as glob

Check warning

Code scanning / shellcheck

SC2184 Warning documentation

Quote arguments to unset so they're not glob expanded.

# Conditionals
# ============
Expand Down

0 comments on commit acc541e

Please sign in to comment.