From 873f318352fd0f5b606ad714c073805851a0a824 Mon Sep 17 00:00:00 2001 From: koalaman Date: Tue, 26 Jan 2016 20:03:51 -0800 Subject: [PATCH] Updated SC2016 (markdown) --- SC2016.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SC2016.md b/SC2016.md index 36f2156..334367a 100644 --- a/SC2016.md +++ b/SC2016.md @@ -28,6 +28,9 @@ echo '$1 USD is '"$rate GBP" ### Exceptions -If you want `$stuff` to be a literal dollar sign followed by the characters "stuff", you can ignore this message. +If you want `$stuff` to be a literal dollar sign followed by the characters "stuff", you can [[ignore]] this message. ShellCheck tries to be smart about it, and won't warn when this is used with awk, perl and similar, but there are some inherent ambiguities like `'I have $1 in my wallet'`, which could be "one dollar" or "whatever's in the first parameter". + +In the particular case of `sed`, ShellCheck uses additional heuristics to try to separate cases like `'s/$foo/bar/'` (failing to replace the variable `$foo`) with from the false positives like `'$d'` (delete last line). If you're still triggering these, consider being more generous with your spaces: use `$ { s/foo/bar; }` instead of `${s/foo/bar/;}` +