executing a ksh script from another ksh script

Hi,

I'm new to unix scripting.How can i call a script from another script.
I have a.ksh and b.ksh .I have to call b.ksh from a.ksh after it is successfully exceuted.

I tried using
#!/bin/ksh -x in a.ksh and at the end i have used /path/b.ksh

My problem is it is executing only a.ksh.it is not going to b.ksh

Can anyone suggest some solution for this
Thanks !

Simply mention the path of b.ksh in a.ksh, suppose if both are in same directory, you could simply add in a.ksh:

./b.ksh

If no joy, then check if b.ksh is executable?

Hi shereen,

I have tried using that but it is not working because
I have to pass a run time variable for b.ksh.i'm passing same variable for a.ksh also.How can i pass the same variable for b.ksh

Suppose you want to do like this:

#! /bin/ksh
echo "Pass test var to b.ksh"
test=13
export test
./b.ksh

otherwise post code of a.ksh and b.ksh here and mention what exactly you want.

Regards,
Tayyab

Hi

the code is too lengthy.
In short a.ksh is for running a datastage job.
so for executing the job the command i'll give is
./a.ksh dev(environment) jobname.
So now in a.ksh only i'm trying to call b.ksh .this is to ftp the file.for running this script the command should be ./b.ksh dev(environment).

So now i need to pass the dev to b.ksh

So how can i do this

I'm not sure what you are exactly looking for, maybe any one else could help you on this issue.

Regards,
Tayyab

#! / bin/ksh
# a.ksh
# your code.

# save argument 1 to be used later.
DEV_ENV=$1 

# rest of the code.

# invoke b.ksh
./b.ksh $DEV_ENV

Infact I dont think you need to save $1. You might as well invoke b.ksh as

./b.ksh $1