Doug Stewart on 18 Apr 2019 15:08:41 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Determining when a shell script is sourced


Perhaps SO has the answer? 

https://stackoverflow.com/questions/2683279/how-to-detect-if-a-script-is-being-sourced
--
Doug Stewart

On Apr 18, 2019, at 5:27 PM, K.S. Bhaskar <ksbhaskar@gmail.com> wrote:

We have a shell script (starts with #!/binsh and is at https://gitlab.com/YottaDB/DB/YDB/blob/master/sr_unix/ydbinstall.sh) that should preferably not be source'd. Is there a way to test within the script whether someone has source'd it and generate an error without terminating the shell session that source'd it? Thank you very much.

Regards
– Bhaskar
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug