In my zsh script, I had a line
echo some text ================================
To my surprise, an error message was issued for this line:
zsh: =============================== not found
Experimenting from the command line, I found that the shell gets upset when there is an equal sign:
$ echo =z
zsh: z not found
But here, we have:
$ echo =echo
/usr/bin/echo
From this observation, it looks, as if
=XXX
would be interpreted like
$(which XXX)
However, I didn't find anything about this "substitution" in the zsh manpage. Where is this piece of magic described?
symbol or operator in Linux can be used as Logical Negation operator as well as to fetch commands from history with tweaks or to run previously run command with modification. All the commands below have been checked explicitly in bash Shell. Though I have not checked but a major of these won't run in other shell.
What is Zsh? Zsh, also known as the Z shell, extends functionality of the Bourne Shell (sh), offering newer features and more support for plugins and themes. Starting with MacOS Catalina in 2019, Zsh became the default login and interactive shell in Mac machines.
From man zshbuiltins , under the entry for typeset (of which declare is a synonym): For each name=value assignment, the parameter name is set to value. Note that arrays currently cannot be assigned in typeset expressions, only scalars and integers.
Quoting is used to remove the special meaning of characters or words: quotes can disable special treatment for special characters, they can prevent reserved words from being recognized as such and they can disable parameter expansion.
From the docs:
14.7.3 ‘=’ expansion
If a word begins with an unquoted ‘=’ and the EQUALS option is set, the remainder of the word is taken as the name of a command. If a command exists by that name, the word is replaced by the full pathname of the command.
And here in more words
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With