Date: Mon, 23 Sep 2024 12:16:10 +0300 From: Valery Ushakov <u...@stderr.spb.ru> Message-ID: <zvex2vpndqb8a...@snips.stderr.spb.ru>
| I'd like to switch this to the "early return" style, something like | | # the rest of the file is for interactive shells only | case "$-" in *i*) ;; *) return ;; esac I think the primary motivation for not doing it that way is so the file can be used as a script ("sh .shrc") for testing. It makes no difference when used via "." (which is how the startup files are typically read) which are kind of like functions (without parameters, and so "return" is valid) - but the return won't work if used as a script, you'd need to use exit instead ... and exit is something that you absolutely wouldn't want to do when the file is being used normally. kre