Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-07-2004, 03:06 PM   #1
LQ Newbie
Registered: Sep 2004
Posts: 2

Rep: Reputation: 0
bash script includes?

I am fairly new to the bash scripting thing. I've written up a nice script to perform some automated work functions. But as I add to the script it has gotten longer and more difficult to manage.

Other programming types allow the use of include files. Does bash scripting offer such a thing? I tried searching for help on this and have not found anything concrete with what I need. The only include I found was in the manual page and it seems to just immediately execute the file.

I have a number of functions or procedures in the script file and would like to let some of those reside in other files. That way I could keep the menu functions in one file, the file manipulation functions in another, etc.

Any help would be appreciated.

Thanks in advance.
Old 09-07-2004, 03:15 PM   #2
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Welcome to LQ.

Just source the script to bi included - ie:

# Load the config
. /path/to/

# Echo some configuration variable
echo $myconfigvar
Old 09-07-2004, 05:46 PM   #3
LQ Newbie
Registered: Sep 2004
Posts: 2

Original Poster
Rep: Reputation: 0
That did the trick. Thank you very much. This makes debugging my scripts a bit easier than before. It also seems to be easier to add functionality to as well.
Maybe someday I will get into writing real programs in a real language.


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
more help with bash script please poiuytrewq Linux - Newbie 6 10-26-2004 09:57 PM
Bash programming .. multiple includes ?? michael_util Programming 2 08-09-2004 11:47 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-05-2003 11:58 PM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 05:34 AM > Forums > Linux Forums > Linux - Software

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