LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Different Operators (https://www.linuxquestions.org/questions/linux-newbie-8/different-operators-752989/)

caponewgp 09-05-2009 08:32 PM

Different Operators
 
I was wondering if anyone could help me with the differences between "$PWD" '$PWD' `$PWD`. Basically I just don't understand exactly how '' "" `` change the output of the command. Thanks again

paulsm4 09-05-2009 08:54 PM

Hi -

Quote:

# Prints the contents of shell variable "PWD" (the current directory)
echo $PWD
/tmp
Quote:

# Equivalent: the double quotes simply make sure that, if there were multiple "words" (like "aaa" "bbb" and "ccc"), they would all be part of the same, single string:
echo "$PWD"
/tmp
Quote:

# The single quotes PREVENT the shell from "expanding" $PWD:
echo '$PWD'
$PWD
Quote:

# The back-quotes expand "$PWD" first, then try to use it as an argument:
# BAD EXAMPLE:
echo `$PWD`
bash: /tmp: is a directory
'Hope that helps .. PSM


All times are GMT -5. The time now is 04:48 AM.