There are a number of problems with your command, fortunately they're all easy to resolve:
As Quasimodo mentioned in their comment, ’
is not a valid character for delimiting strings within Bourne Again Shell (aka "BASH", the default shell interpreter on Kali Linux). Replacing that with single quotes ('
) or double quotes ("
) will be required. Here is some great information on quoting within BASH.
You are attempting to use "escape sequences" within your echo
command, but are not providing the -e
flag.
Based on the fact that you don't want the dollar sign character ($
) in your output, it would appear you are attempting to perform "parameter expansion" or (as noted by steeldriver in the comments) to create an [ANSI Quoted String] (https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html).
As per the GNU BASH documentation for ANSI Quoting:
Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped characters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded
An understanding of escape sequences is the important distinction in this answer. One can choose where shell expansion is occurring: at the stage of running echo
or in the use of the ANSI quoting. This distinction is made because there are situations where specifying these sorts of expansions must be done outside of echo
to have the desired effect. After thinking about this further, I recalled awk
is a tool where I have seen this issue come up:
Use backslash or single-quotes for field separation
In general, I would also review the "Newbie traps - Variables" section of the BASH Hackers wiki, specifically the subsections on "Setting Variables" and "Expanding (using) variables".
These are basic syntax issues with BASH itself and would not be affected by minor version updates to Kali.
EDIT: Added the breakdown of 3a/3b to include information from steeldriver's comment.
#!
line identifying the interpreter to use for the file), and how do you run the script? – Chris Davies Feb 22 '21 at 17:36