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 03-16-2011, 07:01 PM   #1
Ribo01
Member
 
Registered: Aug 2010
Posts: 103

Rep: Reputation: 5
shell symbols ?


In shell scriptings, what do or what does this symbol do or mean ? "."(octet), ";" (semicolon)? Would really like to know? Cause I saw a written script if [ -f /etc/file ];then. . /etc/file. Wondering, the "." is meant to be source, so is "." the same thing as "source" ?thank you.

Last edited by Ribo01; 03-16-2011 at 07:06 PM.
 
Old 03-16-2011, 07:14 PM   #2
Ignotum Per Ignotius
Member
 
Registered: Sep 2009
Location: Wales, UK
Distribution: Slackware
Posts: 69
Blog Entries: 3

Rep: Reputation: 42
Formatting the snippet using BBCode to make it easier to read...

Code:
if [ -f /etc/file ];
then 
  . /etc/file
fi
Yes, the . performs the same task as source (see the bash manual page and look for the section "SHELL BUILTIN COMMANDS"). The semicolon here is part of the syntax for the if statement (again see the bash man page --- it's described under "SHELL GRAMMAR" and is towards the end of the sub-section titled "Compound Commands").

The if statement above simply checks that /etc/file exists and is a regular file, and if it exists, then it sources it.

Hope that answers your query!
 
Old 03-16-2011, 08:54 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Also, the ';' in that usage is redundant; a newline is sufficient to separate cmds for the parser.
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/
 
  


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
'nm' lists all symbols - including static library symbols painulyarun Programming 4 04-06-2010 05:04 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 5 03-25-2007 10:44 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 1 03-03-2007 08:46 PM
vi symbols mean? curos Linux - Software 3 01-03-2007 08:35 PM


All times are GMT -5. The time now is 09:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration