forked from koalaman/shellcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
SC1077
Vidar Holen edited this page Oct 4, 2015
·
4 revisions
echo "Your username is ´whoami´"
echo "Your username is $(whoami)" # Preferred
echo "Your username is `whoami`" # Deprecated, will give [SC2006]
In some fonts it's hard to tell ticks apart, but Bash strongly distinguishes between backticks (grave accent `
), forward ticks (acute accent ´
) and regular ticks (apostrophe '
).
Backticks start command expansions, while forward ticks are literal. To help spot bugs, ShellCheck parses backticks and forward ticks interchangeably.
If you want to write out literal forward ticks, such as fancyful ascii quotation marks:
echo "``Proprietary software is an injustice.´´ - Richard Stallman"
use single quotes instead:
echo '``Proprietary software is an injustice.´´ - Richard Stallman'
To nest forward ticks in command expansion, use $(..)
instead of `..`
.