LinuxQuestions.org
Review your favorite Linux distribution.
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 04-12-2014, 07:46 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 536

Rep: Reputation: Disabled
When are quotes required in a configuration file?


My /etc/sysconfig/network-scripts/ifcfg-eth0 file looks like the following. How do I determine if quotes are required? For instance, IPV6INIT is set to yes, and IPV6_AUTOCONF is set to "yes". Thank you

Code:
DEVICE=eth0
BOOTPROTO=none
HWADDR=88:51:fb:51:df:70
IPV6INIT=yes
IPV6_AUTOCONF="yes"
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
UUID="3785eaeb-542f-4d1b-989c-5580a314a59f"
IPADDR=192.168.0.200
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
USERCTL=no
DNS2=8.8.4.4
DNS1=8.8.8.8
 
Old 04-12-2014, 08:45 AM   #2
mddnix
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch, Ubuntu
Posts: 498

Rep: Reputation: 137Reputation: 137
You don't have to put quotes. its just a personal preference.
 
Old 04-12-2014, 09:50 AM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 536

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by mddesai View Post
You don't have to put quotes. its just a personal preference.
Thanks mdesai. No exceptions? Is it considered good or bad practice to always include quotes?
 
Old 04-12-2014, 10:55 AM   #4
mddnix
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch, Ubuntu
Posts: 498

Rep: Reputation: 137Reputation: 137
Unless there are multiple parameters, quotes are not necessary.
Interface Configuration Files
 
Old 04-12-2014, 11:04 AM   #5
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 536

Original Poster
Rep: Reputation: Disabled
Thank you
 
Old 04-12-2014, 11:14 AM   #6
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian
Posts: 1,054

Rep: Reputation: 276Reputation: 276Reputation: 276
It reallly depends on the conf file. Each program is free to decide how to parse its config files. Sometimes you need quotes if there are spaces or any other non-alpha characters in the string. Sometimes not. The only way to know for sure is to read the man pages for the package.
 
Old 04-12-2014, 12:01 PM   #7
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 536

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sgosnell View Post
It reallly depends on the conf file. Each program is free to decide how to parse its config files. Sometimes you need quotes if there are spaces or any other non-alpha characters in the string. Sometimes not. The only way to know for sure is to read the man pages for the package.
One in particular I was having problems with was wpa_supplicant. I see how I can do both "man wpa_supplicant" as well as "man wpa_supplicant.conf". They don't explicitly address quotes, but sometimes show quotes around a string in their examples. Do you typically base whether quotes are required based on an example in the man page?
 
Old 04-12-2014, 01:14 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,599

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
In this particular instance, the "configuration file" is/used to be a shell script included, so quoting rules follow the requirements of the shell script. You can get REALLY creative with that.

Now that NetworkManager is supposed to do everything it might not be a shell script interpreting it.
 
Old 04-12-2014, 06:44 PM   #9
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 536

Original Poster
Rep: Reputation: Disabled
Don't know how really creative I wish to get right now

Slightly off topic but what about caps? Is yes and YES and "yes" and "YES" and 'yes' and 'YES' and Yes and 'Yes' and "Yes" typically the same?
 
Old 04-12-2014, 10:09 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
No

For one thing, Linux is case sensitive by default, for cmd, params, filenames etc etc.
However, a programmer can choose to be case insensitive when accepting arguments; fairly normal when accepting Yy/Nn and other variations on yes/no.

As above, quotes are 'usual' if a single arg can have eg spaces in it.
Check bash quoting https://www.gnu.org/software/bash/ma...le-Quotes.html for side effects of single (' ') vs double (" ") quotes.
 
  


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
[SOLVED] Difference between echo of file within double quotes and without double quotes ankitpandey Programming 2 01-11-2013 10:02 AM
translate value from single quotes to double quotes venkateshrupineni Linux - Newbie 2 06-14-2012 04:03 PM
escaping double quotes in a file koszta5 Linux - Newbie 3 12-12-2010 10:32 PM
cool quotes for T-shirt regarding open source required @nthoon General 3 08-14-2009 05:59 PM
Using single quotes vs double quotes in PHP strings vharishankar Programming 6 07-11-2005 12:41 PM


All times are GMT -5. The time now is 03:03 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