Inner script run and its exit status

Main Script

#!/bin/ksh

echo "Maimn script"

./clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts/secondscript.ksh

echo "$? = status"

Sdecond Script

#!/bin/ksh

echo "In second SCript"
exit 1

Output:

Maimn script
./testmain.ksh[8]: ./clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts/secondscript.ksh: not found [No such file or directory]
127 = status

Both the script has full permissions.
when i replace the absolute path with relative path(./secondscript.ksh) the script is working fine.
issue is when we keep the absolute path

./clocal/www/... is not an absolute path, but relative to your current working directory.

I'm confused by your post. Expanding on what RudiC has already said, you are implying that the above scripts are not working because they contain absolute pathnames, but the only absolute pathnames in either of these scripts is /bin/ksh . Any pathname starting with ./ is a relative pathname that is looking for a file in a directory rooted in the current working directory.

In what directory are these scripts located?

What is your current working directory when you try to run these scripts?

What are the contents of the PATH environment variable when you try to run these scripts?

Exactly what command line(s) did you try to use to invoke these scripts?

Sorry for the confusion

The scripts are present in this folder /clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts

But the home directory will be /clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator

I tired like this

#!/bin/ksh




echo "Maimn script"

. /clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts/secondscript.ksh

echo "$? = status"

It gives the output

./testmain.ksh
Maimn script
In second SCript

when it en counters the exit 1 command in second script. it is exiting the parent script too..
I need to capture status in parent script.

Using the dot command to run a file:

. /clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts/secondscript.ksh

reads that script and runs it in the current shell execution environment. So, the exit in secondscript.ksh exits both scripts.

Just leave out the dot ( ) to run the script as an external process:

/clocal/www/web-data/WAS/WebSphere7/scripts/DealerLocator/Scripts/secondscript.ksh

and when it exits, your main script will be able to pick up its exit status.