Executing shell file within another shell file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Executing shell file within another shell file
# 1  
Old 06-19-2007
Executing shell file within another shell file

Hello Everybody

I have a shell script file which contains certain intialisation.Initialisation section is around 20 lines.This initialisation section is required by 20 shell script files.

Intialisation shell script contains only initialisation of variables and it is not a good practise to deplicate the same script in all 20 shell script

Instead of that i want to call single initialisation script file in all 20 shell script which used it.

Kindly tell me how to go about it.

For example , below is section of initialisation section which have variable named CLASSPATH and this entire scripting is available in a single shell scrip file.

Code:
CLASSPATH=/opt/programs/appl/:
CLASSPATH=${CLASSPATH}:.
CLASSPATH=${CLASSPATH}:<APPL_DIRECTORY>/lib/log4j-1.2.14.jar

Now i need to call this shell script inside another shell script and also want to access the variable CLASSPATH.

How to do it ...

Reply is very much appreciated
# 2  
Old 06-19-2007
Your_script
Code:
. /path/script_containing_variables
......

Leave a space between dot and script name
# 3  
Old 06-19-2007
Thanks very much ...it is working ..i really appreciate for ur valuable reply
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

2. Shell Programming and Scripting

Compiling and Executing a Java File With a Shell Script

I'm trying to use a shell script to compile and execute a java file. The java classes are using sockets, so there is a client.java file and a server.java file, each with their own shell script. I also want to handle the command line arguments within the shell script, not the java classes. The... (1 Reply)
Discussion started by: britty4
1 Replies

3. Shell Programming and Scripting

Help with Shell Scrip in Masking particular columns in .csv file or .txt file using shell script

Hello Unix Shell Script Experts, I have a script that would mask the columns in .csv file or .txt file. First the script will untar the .zip files from Archive folder and processes into work folder and finally pushes the masked .csv files into Feed folder. Two parameters are passed ... (5 Replies)
Discussion started by: Mahesh G
5 Replies

4. Shell Programming and Scripting

Daemon not executing shell file

Hey guys, I'm rather new to scripting with the shell (I started on Wednesday) and encountered a problem that left me clueless. I moved to an old house recently and the sound of the 433mhz door bell is too quiet. Since I always wanted to start playing around with a raspberry pi and my wife... (11 Replies)
Discussion started by: matthes0815
11 Replies

5. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

6. Shell Programming and Scripting

Creating a Continuous File Reading-Executing Shell Script

I need to write something that will read and execute all the files(Mainly executable scripts) inside one or more folders; in other words, a continuous chain with a break when finished. I'm new to shell and need syntax help. I'm on Ubuntu 12.10-Gnome btw. Here are some main highlights I think... (2 Replies)
Discussion started by: linuxlololol
2 Replies

7. Shell Programming and Scripting

getting : No such file or directory while executing a shell script

Hi all, I am getting : No such file or directory while executing a shell script. But i have that corresponding file in the corresponding path. It also have executable rights. Please help me out in this Thanks in advance. Ananthi.U (7 Replies)
Discussion started by: ananthi_ku
7 Replies

8. Shell Programming and Scripting

Executing Multiple .SQL Files from Single Shell Script file

Hi, Please help me out. I have around 700 sql files to execute in a defined order, how can i do it from shell script (3 Replies)
Discussion started by: anushilrai
3 Replies

9. Shell Programming and Scripting

executing shell file in jva + tomcat

Colleagues, i have an jsp application which uses a servlet for controlling the request. the servlet uses a java class that will invoke a shell script. when i involked a shell script using java's runtime.exec command , it didnt work... applications used are tomcat5, Fedora 6 and java1.5.0_09... (1 Reply)
Discussion started by: jaganadh
1 Replies

10. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question