From e7c9b570ff7581c9ba30261419ebed4a793a4be4 Mon Sep 17 00:00:00 2001 From: Matthias Morin <14804833+TangoMan75@users.noreply.github.com> Date: Sat, 13 Feb 2021 22:16:30 +0100 Subject: [PATCH] fix small typo --- SC2001.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SC2001.md b/SC2001.md index 8942b07..0fb2229 100644 --- a/SC2001.md +++ b/SC2001.md @@ -3,13 +3,13 @@ ### Problematic code: ```sh -string="stirng" ; echo "$string" | sed -e "s/ir/ri/" +string="string" ; echo "$string" | sed -e "s/ir/ri/" ``` ### Correct code: ```sh -string="stirng" ; echo "${string//ir/ri}" +string="string" ; echo "${string//ir/ri}" ``` ### Rationale: @@ -21,7 +21,7 @@ Let's assume somewhere earlier in your code you have put data into a variable (E Occasionally a more complex sed substitution is required. For example, getting the last character of a string. ```sh -string="stirng" ; echo "$string" | sed -e "s/^.*\(.\)$/\1/" +string="string" ; echo "$string" | sed -e "s/^.*\(.\)$/\1/" ``` This is a bit simple for the example and there are alternative ways of doing this in the shell, but this SC2001 flags on several of my crazy complex sed commands which are beyond the scope of this example. Utilizing some of the more complex capabilities of sed is required occasionally and it is safe to ignore SC2001.