Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of "." to run one shell inside another

Status
Not open for further replies.

PJHitchman

Programmer
Jun 8, 2005
2
GB
Hi,
Working in the ksh on Solaris 9.

I create a sort of "library" shell script that defines variables etc and then execute that inside my application shell using the "." operator.

But when the "library" shell script does not exist, the application shell exits complaining that it cannot be found.

e.g x.sh is
. y.sh

so if y.sh cannot be found I get:-
x.sh: y.sh: not found

Thanks

Pete

Is there a way of keeping the execution of the top level script running, so that I can control the exit?
 
check if y.sh exists first:

[ -x ysh.sh ] && . ysh

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
You may try this:
[ -s "$(whence y.sh)" ] && . y.sh

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top