Drew DeVault on 18 Apr 2019 15:25:32 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [PLUG] Determining when a shell script is sourced |
On 2019-04-18 6:24 PM, Andrew M. wrote: > # Try to execute a `return` statement, > # but do it in a sub-shell and catch the results. > # If this script isn't sourced, that will raise an error. > $(return >/dev/null 2>&1) Nit: this isn't a subshell. You want (), no $ ___________________________________________________________________________ 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