Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-21-2010, 08:59 AM   #1
Registered: Feb 2010
Location: /Earth/UK/England/Hampshire
Distribution: Debian, Ubuntu, CentOS, Slackware
Posts: 262
Blog Entries: 2

Rep: Reputation: 56
Simple Question? The 'DOT' in a shell script test

I was looking at this line in an init file:

test -f /etc/default/postfix && . /etc/default/postfix
Which I understand to mean test that files /etc/default/postfix AND etc/default/postfix exist. Two things crossed my mind.

First, There was no action associated with the line at all - so regardless of the result of the test, it appears to be superfluous - unless....

I noted the period/dot just after the && and I don't honestly know what it means in this context.

Google would be the first port of call, but searching for '.' is notorious. The best I could find was 'run in the same shell' but I can't make the connection in my brain of where this fits in to the context of the test.

Can anyone put me out of my misery?
Old 02-21-2010, 09:01 AM   #2
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
The statement reads, if /etc/default/postfix exists, then source /etc/default/postfix.

The '.' means source the file. That is, make the contents of the file part of the current environment.

Usually the file will contain functions and/or variables that are set.

Last edited by macemoneta; 02-21-2010 at 09:02 AM.
1 members found this post helpful.
Old 02-21-2010, 09:45 AM   #3
Registered: Feb 2010
Location: /Earth/UK/England/Hampshire
Distribution: Debian, Ubuntu, CentOS, Slackware
Posts: 262

Original Poster
Blog Entries: 2

Rep: Reputation: 56
I never knew that! You've given me a much needed pointer to find out more. Really appreciate it - thanks for your time and response.


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
Need help getting started simple simple shell script dhonnoll78 Programming 6 12-17-2007 06:34 PM
veprory simple but frustrating for a newbie shell script question marigb Linux - Newbie 11 04-28-2004 01:11 PM
simple shell script question. strifel Programming 7 09-13-2003 02:44 PM
simple question on shell script gsbarry Linux - General 2 05-23-2003 05:09 AM
simple shell script question mathfeel Linux - General 12 03-06-2003 12:23 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:41 PM.

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