Originally Posted by thamann
What does the $ mean?
I put it here:
but I also see in the example:
$ echo "$EAGLE_users\n"
inquiring minds want to know?? can you recommend a good book?
Well, you have already got the answer to your original question. So, I talk about this one which is already answered. But let me explain you smoe more in details:
In Shell Script (on Unix / Linux) when you set a variable's value you do not use a $ before the variable's name:
and you do not leave any space before and after the =
When you want to use a variable's value then you simply prefix it with a $ sign:
You can think of the $ sign as: Substitute whatever is contained by the variable sticking next to me.
If you put single quotes:
then the output would be:
and not 1.
Double quotes will do the substitution operation first before giving the output.
echo -e "This is going to be a mess here...\n"
Now try this:
echo -e "This is going to be nice...\n"
Note the backticks, they are not single quotes: `
Also note that -e
will interpret the escape character which is \n
in the above example.
Sycamorex has suggest you an excellent guide: Advanced Bash Script.
You can also check Beginner's Bash Script guide on the same web site:
and there are PDF versions also.