Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by gbr-app-1.alpinelinux.org (Postfix) with ESMTPS id CF5E3223659 for <~alpine/users@lists.alpinelinux.org>; Mon, 27 May 2024 20:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sdaoden.eu; s=citron; t=1716842949; x=1717509615; h=date:author:from:to:cc:subject: message-id:in-reply-to:references:mail-followup-to:openpgp:blahblahblah: author:from:subject:date:to:cc:resent-date:resent-from:resent-to: resent-cc:in-reply-to:references:mime-version:content-type: content-transfer-encoding:message-id:mail-followup-to:openpgp: blahblahblah; bh=fbWE5hFM0+JkPsirNtuAjZJnPaeKTRJ1h6caqu3tEp0=; b=F9LfFXRwWZJNGkV5pFJLkadW62kSgoGfg8IzzQ2Jz+RFdsEyCbA7jLPw/StIGqn38AK3c4hz ZWypDx5IbBYk+npyWmjvSNfkVpE7FsNqiOGqcJCjlRDQsb54IGJIrow4f9rB7LIOjLUARC9LDs +RvCsKTPMGC+1ulKEQNVw+A4DaUnsuPQbsZwCYR6Mh9MznMcIVm55IYHYSWzsRR6H6RMBSdUh1 dZeg1Php0P9VJLoI5cxduSmgk+ZqVumEDuWRkWEM3t2ywSbPv84W/yhpur87q1IxSvZ31tW8Zb OXu2aS807M7wan686rQCdS8QUgmf6QQOSiD4rKuNz3a+kbIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=sdaoden.eu; s=orange; t=1716842949; x=1717509615; h=date:author:from:to:cc:subject: message-id:in-reply-to:references:mail-followup-to:openpgp:blahblahblah: author:from:subject:date:to:cc:resent-date:resent-from:resent-to: resent-cc:in-reply-to:references:mime-version:content-type: content-transfer-encoding:message-id:mail-followup-to:openpgp: blahblahblah; bh=fbWE5hFM0+JkPsirNtuAjZJnPaeKTRJ1h6caqu3tEp0=; b=YGc4KGpltYP0vxKOHq2qAUURikNVdP6uIkCnctZ15MyjjV88DS++F52U/ON2GO8djjYBYFal WSBDrzR5ezIRCQ== Date: Mon, 27 May 2024 22:49:07 +0200 Author: Steffen Nurpmeso From: Steffen Nurpmeso To: Tobias Leupold Cc: ~alpine/users@lists.alpinelinux.org Subject: Re: ash and su/su - Message-ID: <20240527204907.py3IhgpW@steffen%sdaoden.eu> In-Reply-To: <2207810.C4sosBPzcN@ginuog> References: <1926392.IobQ9Gjlxr@ginuog> <20240525230708.4BKNEgwF@steffen%sdaoden.eu> <2207810.C4sosBPzcN@ginuog> Mail-Followup-To: Tobias Leupold , ~alpine/users@lists.alpinelinux.org User-Agent: s-nail v14.9.24-621-g0d1e55f367 OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. Hello. Tobias Leupold wrote in <2207810.C4sosBPzcN@ginuog>: |> One is a full login, the other only starts an interactive shell |> i would think. Look at the content of $- and source your profile |> if you really want to. | |$- is "smi" -- IIRC, this variable contains the options set for the \ |current |shell. But I don't think this helps here? Well, i have in my ~/.profile (that used to work with quite a lot of shells) for example # Some (ksh(1), NetBSD sh(1)) correctly auto-include $ENV, but bash(1) doesn't # (unless invoked interactively as sh(1) not bash(1)); # also, Heirloom sh(1) doesn't know about it at all, so do include it here and # let it protect itself against multiple inclusion in the same shell ENV="${HOME}/.shrc" export ENV if [ -f "${ENV}" ]; then # Also, for bash(1) to recognize this $ENV when started as $bash not $sh, # we need to create a ~/.bashrc symlink! if [ -f ./.bashrc ]; then : elif [ -L ./.bashrc ] && [ "`readlink ./.bashrc`" = "${ENV}" ]; then : else rm -f ./.bashrc ln -s "${ENV}" ./.bashrc fi # However, if we know for sure anything is fine, simply skip inclusion case ${0} in *ksh*|*bosh*) ;; *) . "${ENV}" ;; esac fi I do not say it is nice. And in my ~/.shrc (which sets prompts, too) eval "___isinc=\$___SHRC$$" if [ -z "${___isinc}" ]; then eval "___SHRC${$}=YES" export ___SHRC${$} case ${-} in *i*|*m*) # {{{ # New bash(1) (4.3.39) seem to loose it somehow : ${TMPDIR:=/tmp} export TMPDIR ___on_exit() { [ -f "${HOME}/.bash_logout" ] && . "${HOME}/.bash_logout" } trap ___on_exit EXIT # Determine shell type; aux while there ps1s= ps1S= ps1e= ps1W= ;; # }}} esac fi unset ___isinc |Of course, I could manually source my ~/.profile after an "su". But \ |I would |like to automate this. Mainly, it's about my PS1 ... | |> (Or create a file to source with all the things you really always \ |> want, and |> put in .profile only things really needed for login sessions etc.) | |Which file would that be? It all depends on the actual shell. If you have bash, then ensure ~/.bashrc exists, bash will read it. Hope this helps, Ciao! --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)