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.

- 1
- 1

- 1,003
- 1
- 8
- 19
-
4*is it just a notation to tell it's a bash command?* Yes, it is. – Luiggi Mendoza Feb 24 '15 at 15:50
-
http://www.gnu.org/software/bash/manual/bashref.html#Command-Substitution – Etan Reisner Feb 24 '15 at 15:50
-
@EtanReisner that's for `$`s (technically `$(...)`) that are *inside* the command, not at the beginning. – Jon Egeland Feb 24 '15 at 15:53
-
@Jon What? Are you suggesting that `$(echo echo foo)` and `echo $(echo foo)` are somehow different uses of `$(...)`? – Etan Reisner Feb 24 '15 at 15:54
-
@EtanReisner No, I'm suggesting that something like `$ source ~/.bash_profile` (what the OP is referencing) is *very* different than `echo $(echo foo)` (what you are referencing). – Jon Egeland Feb 24 '15 at 15:57
-
lol, its just to show that it is the command line and not output – Feb 24 '15 at 16:04
-
@Jon Ah! You assumed he meant lines 1, 3, and 4 in that answer (ignoring `$JAVA_HOME`). I assumed he meant line 2. You could very well be correct. – Etan Reisner Feb 24 '15 at 16:15
2 Answers
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!

- 46
- 2
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.