I have a fish script that exports some variables and launches a command at the end. I'd like to be able to source this file to bring these variables into the current shell session, but without executing the command at the end.
The question: Can I figure out whether the current file is being executed or sourced from within the file?
.case (where.is an alias forsource). It also adds a common use case of this check, which I wish was included in software like Python's venv activator (instead of just doing nothing silently and leaving you confused). – HumpbackWhale194 Dec 25 '23 at 06:06