LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2009, 12:14 PM   #1
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Rep: Reputation: 37
("") vs ('') what is the difference...?


Im just wondering what is the difference between using double quotes ("") and single quotes ('') when enclosing a command parameter... example:

im modifying my .bashrc file and I have the follwoing two commands:

Code:
export PS1="[\[\033[1;34m\w\[\033[0m]\n[\t \u]$"
and

Code:
BLACK='\e[0;30m'
would it be the same to exchange the symbols or not?...
just wondering...

Last edited by RaptorX; 07-21-2009 at 12:16 PM.
 
Old 07-21-2009, 12:23 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Single quotes prevent shell expansion: they protect a string from the shell so that it can be interpreted literally. Double quotes let the shell do expansion so that you can use shell variables (or commands) inside a string. More info here and here.
 
Old 07-21-2009, 12:35 PM   #3
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37
thanks for the info...

so that means that for example in my bashrc i declared BLACK then:

PS1="${BLACK}blah blah blah" would work while:

PS1='${BLACK} blah blah blah' wouldnt?? it would take it literally?
 
Old 07-21-2009, 12:37 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Yes. You got the point!
 
Old 07-21-2009, 12:40 PM   #5
RaptorX
Member
 
Registered: Jun 2009
Location: Emden, Germany
Distribution: Slackware 12.2, Slax 6.1
Posts: 254

Original Poster
Rep: Reputation: 37


im reading now... thanks for the links!
 
Old 07-21-2009, 04:12 PM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,830

Rep: Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409Reputation: 2409
you missed the " back tic" -- " ` ` "
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 05:08 PM
What is the difference between "make deinstall clean" and "pkg_delete"? Mr_Shameless *BSD 3 04-20-2007 08:41 PM
Can you explain the difference between "Free Software (GNU)" and "Open Source"? vharishankar General 5 03-03-2005 10:40 AM
difference between "Web server local URL" and "IPv4 address"? kpachopoulos Linux - General 2 09-17-2004 02:30 PM
"User" & "System" CPU load difference JJX Linux - General 3 06-06-2004 02:42 AM


All times are GMT -5. The time now is 08:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration