At Tue, 24 Sep 2024 00:56:40 +0200, Steffen Nurpmeso <steffen%sdaoden.eu@localhost> wrote: Subject: Re: interactive shell detection in shrc > > case ${-} in > *i*|*m*) # {{{ > ... > esac I'm very curious: why did you include "m" in that test? I do note the following from the bosh(1) manual: ... POSIX requires that job control is auto-enabled for interactive shells ... But I'm pretty sure the key word there is "interactive", which will by definition also mean they have 'i' in $-. For what it's worth I the original Bourne shell (as supplied in pkgsrc shells/heirloom-sh) does not put 'i' in $- (ever). The enhanced Bourne shells, aka the Schily Bourne Shells, shells/bosh and shells/pbosh, similarly do not have 'i' in $- while sourcing ~/.profile, but they do adjust $- after ~/.profile has been sourced. Since they all derive from the same parent I guess the fact they share this quality should not be too surprising. To work around this I do the following: _interactive=false case "$-" in *i*) _interactive=true ;; esac case "$0" in -*) _interactive=true ;; esac if ${_interactive}; then : ... do interactive setup else : ... do script-mode setup fi unset _interactive -- Greg A. Woods <gwoods%acm.org@localhost> Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost> Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgpcCqq2vXAST.pgp
Description: OpenPGP Digital Signature