Skip to content

Files

Latest commit

 

History

History
42 lines (26 loc) · 1.07 KB

SC1077.md

File metadata and controls

42 lines (26 loc) · 1.07 KB

Pattern: Use of ´ for command expansion

Issue: -

Description

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.

Example of incorrect code:

echo "Your username is ´whoami´"

Example of correct code:

echo "Your username is $(whoami)" # Preferred
echo "Your username is `whoami`"  # Deprecated, will give [SC2006]

Exceptions

If you want to write out literal forward ticks, such as fancy ASCII quotation marks:

echo "``The Internet is becoming the town square for the global village of tomorrow.´´  - Bill Gates"

use single quotes instead:

echo '``The Internet is becoming the town square for the global village of tomorrow.´´  - Bill Gates'

To nest forward ticks in command expansion, use $(..) instead of `..`.

Further Reading