What is the difference between " and '


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What is the difference between " and '
# 1  
Old 01-07-2010
What is the difference between " and '

I am a bit confused between " and '.
Could any one give clear description?

Thanks in advance.
# 2  
Old 01-07-2010
All the variables between " " are expanded to their values at runtime. However, if the same variable is put between ' ', it is considered a literal string.

Code:
e.g. var='Test'
echo "$var" --> Output: Test
echo '$var' --> Output: $var

Hope it helps to understand.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mindboggling difference between using "tee" and "/usr/bin/tee" in bash

I'm on Ubuntu 14.04 and I manually updated my coreutils so that "tee" is now on version 8.27 I was running a script using bash where there is some write to pipe error at some point causing the tee command to exit abruptly while the script continues to run. The newer version of tee seems to prevent... (2 Replies)
Discussion started by: stompadon
2 Replies

2. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

3. SuSE

Difference in file size between "ls -l" and "du -a"

mail:/var/lib/named/proc # ls -l |grep kcore -r-------- 1 root root 140737486266368 Jun 3 19:47 kcore mail:/var/lib/named/proc # du -a |grep kcore 0 ./kcore System is SuSE 11.2 SP1. The system appears to run correctly, and the output of df -v shows the correct disk... (1 Reply)
Discussion started by: jgt
1 Replies

4. Shell Programming and Scripting

Question about the difference between "for" and "while" loop

dear all, i got some questions about for/while loop when working on redirect command output to for/while loop. take one for example : in for loop : allfiles=`find /var/log -maxdepth 1 -type f -mtime +5` index=1 for ((i=0; i<${#allfiles}; i++)); do echo "$index:${allfiles}" ... (2 Replies)
Discussion started by: tiger2000
2 Replies

5. UNIX for Dummies Questions & Answers

awk - difference between -F"," and BEGIN{FS=","}

in awk, what is the difference between: -F"," and BEGIN{FS=","} (2 Replies)
Discussion started by: locoroco
2 Replies

6. Shell Programming and Scripting

"date" difference between FreeBSD & Linux

Hi there. I used to use lastdate=`date -v-14d %F` on my old server with FreeBSD, and now got to get the same result(current date -14 or -X days) in script running at another server, with Linux, but there's no such option for "date". How can i solve the prob(counting with absolute day number is... (10 Replies)
Discussion started by: strider_scripts
10 Replies

7. Shell Programming and Scripting

What is the difference executing a script with . in the front versus not putting a "."

Hi All, I know this has been discussed a lot but still I need some more answers. I am running this is ksh on AIX 5.3 I believe putting a "." in front of the script will start a new shell, is that correct?? I have a script which override some PATH variables and it does not do that... (3 Replies)
Discussion started by: Hangman2
3 Replies

8. Solaris

difference between "root" and "usr" packages

Hi, could someone pls enlighten me on the difference between the "root" package and "usr" package? Like in this example: pkginfo -l SUNWGtku | grep -i desc DESC: GTK - The GIMP Toolkit (Usr) and pkginfo -l SUNWGtkr | grep -i desc DESC: GTK - The GIMP Toolkit (Root)... (6 Replies)
Discussion started by: masloff
6 Replies

9. Programming

what difference between "terminal" and "console"

1 . Thank you for reading the post first. 2 . what difference between "terminal" and "console" (1 Reply)
Discussion started by: chenhao_no1
1 Replies
Login or Register to Ask a Question