LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-01-2003, 07:52 AM   #1
ducka
LQ Newbie
 
Registered: Sep 2003
Location: Australia, QLD
Posts: 13

Rep: Reputation: 0
Question Linux Shell programming question


Hi.. im just new to this board so soz if this is a stupid question.

Ive come accross a line of code in my studdies on shell programming, and im stuck on what "exactly" it means..

the particular line of code is:

. /etc/init.d/functions

and the part im curious about is the . / (take note of the white space between the . and the /)

ive tried to derive what this is myself by doing a few test's, and have found that it seems to take a file like a text file (the functions file in this case) and execute it as a shell script.

whats this particular operation called? what exactly does this thing do?

n e way.. any help towards this would be appreciated..

thanks in advance!

Cheers!

Lucas
 
Old 09-01-2003, 08:23 AM   #2
Steave
Member
 
Registered: Jul 2001
Location: Braunschweig, Germany
Distribution: Suse 7.2
Posts: 184

Rep: Reputation: 30
simple question -- quick answer:

the . is a simple include.

So in your example the textfile /etc/init.d/functions is being included into the file you found your line of code in.

Cheers, Steave.
 
Old 09-01-2003, 08:24 AM   #3
bigFro
LQ Newbie
 
Registered: Aug 2003
Posts: 3

Rep: Reputation: 0
Re: Linux Shell programming question

Quote:
Originally posted by ducka
Hi.. im just new to this board so soz if this is a stupid question.

snip...

the particular line of code is:

. /etc/init.d/functions

...snip.....

whats this particular operation called? what exactly does this thing do?
If you've ever used a csh derivative, the '.' is similar to the 'source' command. It will source in the commands into the current running script or environment.

A good example is when you make a change to your .bashrc/.bash_login , you could run ' . ~/.bashrc ' to source in your changes.

-bF
 
Old 09-01-2003, 08:57 AM   #4
ducka
LQ Newbie
 
Registered: Sep 2003
Location: Australia, QLD
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks alot fellas.. thought it might be somthing like that... does it only include text files though? ive tried it with a shell script and it didnt like that..

CHeeRS!

Lucas
 
Old 09-01-2003, 09:24 AM   #5
bigFro
LQ Newbie
 
Registered: Aug 2003
Posts: 3

Rep: Reputation: 0
Quote:
Originally posted by ducka
Thanks alot fellas.. thought it might be somthing like that... does it only include text files though? ive tried it with a shell script and it didnt like that..

CHeeRS!

Lucas

In a sense , you can only source shell scripts, and keep in mind a shell script can contain commands or just hold enviroment variables and functions. They need to be in the sytax of the current running shell. And keep in mind it will execute any commands in the script.

-bF
 
  


Reply



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
question about shell-script programming GSX Programming 11 11-22-2005 04:58 PM
Question about bash shell programming walterbyrd Linux - General 1 11-01-2005 09:42 AM
linux shell programming structure s.santhoshkumar Programming 4 04-05-2005 09:38 PM
simple question on shell programming stupid_guy Programming 5 03-10-2004 02:07 PM
shell programming,c/cpp in linux arunshivanandan Linux - Newbie 2 05-16-2003 04:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:26 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
Open Source Consulting | Domain Registration