[Novalug] How can script know if it's been 'sourced' rather than
'called'?
John Franklin
franklin at elfie.org
Fri Apr 6 22:05:38 EDT 2007
On Apr 6, 2007, at 2:42 PM, Ben Creitz wrote:
> I have little script which starts ssh-agent for a given period of time
> and loads a private key. The script must be "sourced" with source or
> . in order to work, so that the calling shell can access the env vars
> that ssh-agent exports.
>
> Is there a way for the script to fail and echo proper usage if
> somebody calls it directly? Of course, I can remove the execute bit.
> But I would like to avoid people calling it with
I would suggest you test if the env vars you need are set or not,
which is the failure mode anyway.
jf
--
John Franklin
franklin at elfie.org
ICBM: 38º 56' 32.6"N 77º 24' 47.7"W Z+62m
More information about the Novalug
mailing list