[Novalug] How can script know if it's been 'sourced' rather than
'called'?
Ben Creitz
creitz at gmail.com
Fri Apr 6 14:42:59 EDT 2007
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
bash start-ssh-agent 5
, too. It really isn't too important, but I am curious to see if
there's an answer out there.
Ben
More information about the Novalug
mailing list