calling script with multiple variables in second script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calling script with multiple variables in second script
# 1  
Old 04-13-2011
calling script with multiple variables in second script

Hi All,


Just give me an idea on how to do the below logic.

1. I have one master script masterload.sh, the usage of this script is

a. masterload.sh FULL BFLF_LOAD.txt
b. masterload.sh DELTA TDLD_LOAD.txt
c.masterload.sh USER MAS_LOAD.txt

FULL , DELTA ,USER are the varaibles based on this variables inside that particular code will be executed. and the .txt are the source files.

2. Now I am creating one more script mdo_sha.sh(second script) which has to call the masterload.sh and I want to write a loop for the below requirement.

All the BFLF* file names are listed in BFLF.txt
All the TDLD* file names are listed in TDLD.txt
All the MAS* file names are listed in MAS.txt

the second script has to check all these .txt files in the above example and if this files have a value then

it has to do a while loop like iif BFLF.txt has some file names in it then the script has to call the master_load.sh full (and pass the file names one by one from the BFLF.txt)

master_load.sh FULL 1.txt
master_load.sh FULL 2.txt
master_load.sh FULL 3.txt
master_load.sh FULL 4.txt
master_load.sh FULL 5.txt

similarly if TDLD.txt has some value then the script has to call the master_load.sh full (and pass the file names one by one from the TDLD.txt)

master_load.sh DELTA 1.txt
master_load.sh DELTA 2.txt
master_load.sh DELTA 3.txt
master_load.sh DELTA 4.txt

similarly for the thrid one,Pls give some logic on how to implement the same.

--Mora

---------- Post updated at 08:33 PM ---------- Previous update was at 08:22 AM ----------

Hi,


Can some one please give me an idea on how to do this in shell scripting...


--Mora
# 2  
Old 04-13-2011
Hey Mora,

can you tell what exactly should be you out put.

your second script mdo_sha.sh should call the first script and check in all the three .txt files if some file name exists then it should run (the first script, parameter and the file name)master_load.sh FULL 1.txt.., it should be in a while loop.

Are you expecting this as output?

Regards,
Deepti
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script calling multiple scripts (using lock file)

Hi all, i have compiled a script as below. Basically this script is intended to call 3 other scripts, which i intend to run simultaneously. #!/usr/bin/bash HOMEDIR=/path/of/home LOCKDIR=$HOMEDIR/lock #check for LOCK LOCKFILE=$LOCKDIR/$(basename $0 .sh).lock if ; then echo... (2 Replies)
Discussion started by: nms
2 Replies

2. Shell Programming and Scripting

Assigning multiple variables in ksh script

Is it possible to have a user input multiple words in one line and have the script assign each word a variable? I'm stuck please assist. Example using "BILL JOHN SARA JILL" as what the user could type: printf "Enter account names: " BILL JOHN SARA JILL read input (9 Replies)
Discussion started by: seekryts15
9 Replies

3. Shell Programming and Scripting

Calling multiple jobs from single shell script

Hi all, I have developed a shell script where I am executing datastage jobs.This script will be further placed in enterprise scheduler to trigger it at particulat time. I have around 300 jobs , I am passing jobnames to script as a paramere. So is it possible I can trigger all jobs from one... (3 Replies)
Discussion started by: prasson_ibm
3 Replies

4. Shell Programming and Scripting

Running a script with multiple variables like 25 variables.

Hi All, i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way?? #!/bin/ksh ##script is sample.ksh age=$1 gender=$2 class=$3 . . .... (3 Replies)
Discussion started by: Lakshman_Gupta
3 Replies

5. Shell Programming and Scripting

Using a script to define variables and run multiple other scripts in succession.

I'm pretty new to scripting in Korn shell so please forgive me... What I'm trying to do is to create a script that calls multiple other ksh scripts and defines variables for text files. I need it to define my user defined variables (file paths, date & time stamps, etc that are currently in... (1 Reply)
Discussion started by: bluejwxn8
1 Replies

6. Shell Programming and Scripting

Multiple Variables for BASH script

Hello, I am new to the whole "scripting" thing. Below is the script that I have so far and where i need the Variables to go (VAR#) #!/bin/bash #Sample Script VAR1= echo "Choose an option: 1) Create a file. 2) Delete a file. 3) Move a file." read VAR1 case $VAR1 in 1) echo "Pick... (4 Replies)
Discussion started by: eclerget
4 Replies

7. Shell Programming and Scripting

passing a variables value from the called script to calling script using ksh

How do i get the value of the variable from the called script(script2) to the calling script(script1) in ksh ? I've given portion of the script here to explain the problem. Portion of Script 1 ============= ----- ----- tmp=`a.ksh p1 p2 p3` if then # error processing fi -----... (10 Replies)
Discussion started by: rajarkumar
10 Replies

8. Shell Programming and Scripting

problem accessing Multiple Variables from C Program to a Shell script

program name--test #!/bin/bash output1=`/home/user/a.c` output2=`/home/user/a.c` k=`$output1 + 1` m=`$output2 + 1` echo $k echo $m --------------------------------------------------------------------------- prgram name--a.c #include<stdio.h> int main() (1 Reply)
Discussion started by: sameworld1980
1 Replies

9. UNIX Desktop Questions & Answers

trying to create a script with multiple variables...

I have created a script that prompts the user to enter three variables that are seperated by a space as the delimiter. It then performs a command 3 seperate times for each variable entered. I want the script to llow the user to enter as many variables as they may like and the script to... (5 Replies)
Discussion started by: Italy87
5 Replies

10. Shell Programming and Scripting

Pass multiple variables to SQL script

I am trying to close of multiple users in an Oracle database. Each users has records in multiple tables what I need to do is use a script that call each SQL seperately passing either CLI arguments or gathered arguments from the users during run time. ## Accept variable(s) from the command line... (1 Reply)
Discussion started by: jagannatha
1 Replies
Login or Register to Ask a Question