LinuxQuestions.org
Help answer threads with 0 replies.
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, 06: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 06:06 PM.
 
Old 03-16-2011, 06:14 PM   #2
Ignotum Per Ignotius
Member
 
Registered: Sep 2009
Location: UK
Distribution: Slackware, Arch
Posts: 75
Blog Entries: 4

Rep: Reputation: 43
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, 07:54 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,352

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 04:04 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 5 03-25-2007 09:44 AM
Debugger selectively not using symbols in library with symbols Millenniumman Programming 1 03-03-2007 07:46 PM
vi symbols mean? curos Linux - Software 3 01-03-2007 07:35 PM

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

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