If you mean `
by smart quotes, then that is actually called "backquote". Smart quotes are when you type ' and ", but get ‘ and ’ or “ and ” automatically depending on the context. I'm not sure how you would use smart quotes in awk or sed.
In the shell, backquotes, such as `command`
, are used to evaluate a command and substitute the result of the command within them into the shell expression being evaluated; it can be used to compute and argument to another command, or to set a variable. For less ambiguity, you can instead use $(command)
, which makes a lot of quoting rules easier to work out.
In the shell, '
and "
are also different. "
is used for strings in which you want variable substitution and escape sequences. '
represents a string containing just the characters within the quotes, with not variable interpolation or escape sequences.
So, for example:
$ name=world
$ echo "Hello, $name"
Hello, world
$ echo 'Hello, $name'
Hello, $name
$ echo "Testing \\ escapes"
Testing \ escapes
$ echo 'Testing \\ escapes'
Testing \\ escapes
$ echo `ls`
example-file another-example
$ echo 'ls'
ls
$ echo "ls"
ls
Other scripting languages, such as Perl and Ruby, have similar rules, though there may be slight differences.