CrazyYoshi
CrazyYoshi

Reputation: 1143

What is the $ before shell command


I am not used to shell commands and I'm trying to set up Apache Cordova on my Mac, I have difficulties to set up the PATH for the Java JDK. I'm trying to do like in the third answerer of thisquestion.. But whenever I search for setting up jdk's path, I see some lines of command with the $. I understand that what follows it is a command, but is the $ itself a command or some command to enters before like the 'sudo'. Or is it just a notation to tell it's a bash command ? I searched on google but didn't found anything, maybe I searched with the wrong keywords ?
Anyway thanks for helping me.

Upvotes: 0

Views: 341

Answers (2)

Mark Lai
Mark Lai

Reputation: 3

A $ prefixing a variable name indicates the value the variable holds.

end-of-line. In a regular expression, a "$" addresses the end of a line of text.

${} Parameter substitution.

$' ... ' Quoted string expansion. This construct expands single or multiple escaped octal or hex values into ASCII or Unicode characters.

$*, $@ positional parameters.

$? exit status variable. The $? variable holds the exit status of a command, a function, or of the script itself.

$$ process ID variable. The $$ variable holds the process ID of the script in which it appears.

Upvotes: 0

Freya
Freya

Reputation: 46

It's pretty much just there as a separator between the prompt and what you actually type. It's like the > in a Windows/DOS prompt. It indicates a normal user privileges. If the shell had superuser privileges, there would be a # instead of a $.

Hope this helps!

Upvotes: 3

Related Questions