difference between double inverted coma and single inverted comma


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting difference between double inverted coma and single inverted comma
# 1  
Old 02-15-2007
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' ]
# 2  
Old 02-15-2007
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

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

The Shell lost the inverted comma in a nested ssh command

Hi, i want use this Comand for my psql request sh ssh -o StrictHostKeyChecking=no rootatemailaddress.de sudo psql -U postgres -c "select pg_terminate_backend(pid) from pg_stat_activity where datnam=\'$DB\';"'" but the shell lost the inverted comma for datnam=\'$DB\'. The request deliver... (2 Replies)
Discussion started by: peterpane007
2 Replies

2. Shell Programming and Scripting

awk to parse comma separated field and removing comma in between number and double quotes

Hi Experts, Please support I have below data in file in comma seperated, but 4th column is containing comma in between numbers, bcz of which when i tried to parse the file the column 6th value(5049641141) is being removed from the file and value(222.82) in column 5 becoming value of column6. ... (3 Replies)
Discussion started by: as7951
3 Replies

3. Shell Programming and Scripting

Remove inverted duplicates from a mapping database

My excuses for a Title which does not really describe what I need. My OS is Windows Vista/Windows7 I have a large database of homographs with the following structure: name=name variant i.e. a variant of a name is provided on a line separated by a =. An example will make this clear ... (1 Reply)
Discussion started by: gimley
1 Replies

4. Shell Programming and Scripting

Inverted commas replace

Hi, My input file is like this chr1 + "NM_1234" chr1 - "NM_1234" If I want my third column to contain both the first and second column values, how do I do it? I know how to do it by including the column numbers, but I want the values before the inverted commas. So, my output would... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

5. Shell Programming and Scripting

Need Help - comma inside double quote in comma separated csv,

Hello there, I have a comma separated csv , and all the text field is wrapped by double quote. Issue is some text field contain comma as well inside double quote. so it is difficult to process. Input in the csv file is , 1,234,"abc,12,gh","GH234TY",34 I need output like below,... (8 Replies)
Discussion started by: Uttam Maji
8 Replies

6. Shell Programming and Scripting

Searching inverted lines

Hi fellas, I have a file like this: A_B B_D C_D D_B E_F G_H B_A F_E In other words, I have member1_member2 and member2_member1 in the same file. In the exemple aforementioned I have A_B and B_A, B_D and D_B, E_F and F_E. So, I would like to know a sript that print the lines B_A, D_B... (3 Replies)
Discussion started by: valente
3 Replies

7. Shell Programming and Scripting

Insert Inverted Commas Around Numeric Values

Hi, I am trying to insert Inverted Commas around all the numeric values within a comma seperated string / variable. 1111,2222,3333,4444 I would like it to be: '1111','2222','3333','4444' Note - This string could have a differing amount of numeric values each time the variable is... (4 Replies)
Discussion started by: RichZR
4 Replies

8. Red Hat

Sometimes my xterm colors get inverted

I don't know exactly when or why, maybe running less or some command, my white text on a black background gets inverted and all the text looks like it is "selected", it is white background with black text. it is very annoying. I found this solution.;. export TERM=vt100 vi This... (0 Replies)
Discussion started by: srhadden
0 Replies
Login or Register to Ask a Question