The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script needs to be modified - Each 5 Rows to be joined in single line with comma (,) ntgobinath Shell Programming and Scripting 0 05-07-2008 05:37 AM
grep exclude/find single and double quotes Lindy_so UNIX for Dummies Questions & Answers 4 03-06-2008 06:01 AM
Single v. double quotes in sed (GNU utilities for Win32 version) daddydojo Shell Programming and Scripting 2 08-05-2007 02:26 PM
single or double quote in SED asami Shell Programming and Scripting 2 07-17-2006 12:03 AM
Counting occurence of a coma dbrundrett Shell Programming and Scripting 3 01-22-2004 02:40 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 02-15-2007
Registered User
 

Join Date: Feb 2007
Posts: 1
difference between double inverted coma and single inverted comma

Whats the basic difference between double inverted comma and single inverted comma and no comma applied at all?

Eg1 if [ -f "$filename" ]

Eg2 if [ -f $filename ]

iEg3 f [ -f '$filename' ]
Reply With Quote
Forum Sponsor
  #2  
Old 02-15-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,294
Code:
'  is a tic or tic-mark or single quote
" is a double quote
quotes affect how the shell treats a variable.
Code:
if [ -f $filename ] translates $filename - if it has spaces the shell "thinks" $filename
         is really separate values  with no spaces
if [ -f "$filename" ] translates $filename - if it has spaces the shell "thinks" $filename
         is realy one single value, spaces included
if [ -f '$filename' ] does not translate filename - the shell takes the $ literally, not
         as a shell token meaning return the value of a variable
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0