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, 06:46 AM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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, 07:45 AM   #2
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

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

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, 09:55 AM   #4
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

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

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

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
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, 11:01 AM   #7
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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, 12:14 PM   #8
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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, 05:44 PM   #9
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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, 09:09 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 09:02 AM
translate value from single quotes to double quotes venkateshrupineni Linux - Newbie 2 06-14-2012 03:03 PM
escaping double quotes in a file koszta5 Linux - Newbie 3 12-12-2010 09:32 PM
cool quotes for T-shirt regarding open source required @nthoon General 3 08-14-2009 04:59 PM
Using single quotes vs double quotes in PHP strings vharishankar Programming 6 07-11-2005 11:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:00 PM.

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
Open Source Consulting | Domain Registration