From 4dbf9f7dad1178a8ced135a924236c83ecf34f68 Mon Sep 17 00:00:00 2001 From: RareAir12 <169048485+RareAir12@users.noreply.github.com> Date: Mon, 6 May 2024 22:15:52 +0800 Subject: [PATCH] Destroyed SC2006 (markdown) --- SC2006.md | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 SC2006.md diff --git a/SC2006.md b/SC2006.md deleted file mode 100644 index d1b077e..0000000 --- a/SC2006.md +++ /dev/null @@ -1,33 +0,0 @@ -# Use `$(...)` notation instead of legacy backticked `` `...` ``. - -### Problematic code - -```sh -echo "You are running on `uname`" -``` - -### Correct code - -```sh -echo "You are running on $(uname)" -``` - -### Rationale - -Backtick command substitution `` `...` `` is legacy syntax with several issues. - -1. It has a series of undefined behaviors related to quoting in POSIX. -1. It imposes a custom escaping mode with surprising results. -1. It's exceptionally hard to nest. - -`$(...)` command substitution has none of these problems, and is therefore strongly encouraged. - -### Exceptions - -None. - -### Related resources: - -* [BashFaq: Why is `$(...)` preferred over `` `...` `` (backticks)?](http://mywiki.wooledge.org/BashFAQ/082) -* [StackOverflow: What is the difference between $(command) and `` `command` `` in shell programming?](https://stackoverflow.com/questions/4708549/shell-programming-whats-the-difference-between-command-and-command) -* [shfmt](https://github.com/mvdan/sh) will automatically convert the legacy syntax \ No newline at end of file