Answer the question
In order to leave comments, you need to log in
What does the $ symbol mean before a command in a Linux script?
Please explain exactly what the $ symbol means before the Linux command, what is it used for? PS (please just don't write that # this is under root and $ is not privileged mode, this I also know I'm not talking about this) thanks in advance
Answer the question
In order to leave comments, you need to log in
In general, I got an explanation from the author of what he needs
for example, when using the value of a variable, for example, good=bad, then by executing the command echo $good
good=bad
echo good
It's just a prompt string.
It also means that you work under the normal user, and # - under a rue. This is its main purpose, there are no additional functions in this symbol.
The PS1 variable actually contains the prompt string, which usually contains the username, hostname, current directory, and this character.
This is a variable that stores the error code of the previous command. Usually 0 is ok. And another number indicates failure.
Hm. Perhaps it was possible to ask a more illiterate question, if you try. Russian is not happy, huh?
- in front of the command in the terminal - just an invitation character, means that the terminal is ready to accept the command. It is set by the PS1 environment variable, into which you can drive a rather spreading construction - for example:
mch=`hostname -s`
PS1='\[\033[01;32m\]${mch:q}:\[\033[01;34m\][$USER]\[\033[01;36m\] \!>\[\033[00;38m\] '
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question