March 31, 2016

what is the meaning of $ in linux command?

Answer to the question

generally $ is used to refer to a variableĀ 

suppose the value of a variable a=5

then echo $a prints the value of variable a i.e 5

Like  (6 likes)

Answer to the question

$ usually means means one of two things:

If a tutorial say to run

$ ls

it means you should run the command "ls" (without the $) as a regular user, as opposed to running it asĀ  root. If you're told to run something like

echo $TERM

the $ is referencing a variable, in this case TERM.

Here's a quick explanation of what that does:

If you run the command

echo hi

your terminal will output "hi". If you run "echo $TERM", $TERM is replaced with the value of the variable TERM. If you actually run "echo $TERM", you will usually end up with either "xterm" or "xterm-256color"

Like  (12 likes)

Answer to the question

Here's a pretty good explanation , at least in a shell script ...

Like  (4 likes)
Click Here!