Is it fine that admin edits the answer in the way that incorrect answer becomes correct answer absolutely equal to mine and my answer becomes useless?
https://unix.stackexchange.com/posts/162223/revisions
Let me summarize the changes made by @Gilles:
The answers before his edit:
------------begin
Use that syntax: ${parameter/pattern/string}
$ echo ${OUTPUT/\'/x}
axb"c`d
$ echo ${OUTPUT/\"/x}
a'bxc`d
$ echo ${OUTPUT/\`/x}
a'b"cxd
------------end
My answer:
------------begin
OUTPUT="${OUTPUT//[\`\"\']/}"
Note that ${VAR//PATTERN/}
removes all instances of the pattern. For more information bash parameter expansion
------------end
after Gilles edit first answer became:
-----------begin
Use that syntax: ${parameter//pattern/string} to replace all occurrences of the pattern with the string.
$ echo "${OUTPUT//\'/x}"
axb"c`d
$ echo "${OUTPUT//\"/x}"
a'bxc`d
$ echo "${OUTPUT//\`/x}"
a'b"cxd
$ echo "${OUTPUT//[\'\"\`]/x}"
axbxcxd
---------end
So what was changed?
- Added quotes - like in my answer
- Added correct answer string - like in my answer
- Added comment that // replaces all variables - like in my answer
- Nothing else
After these edits their answer became essentially the same as mine.