Received: from mail.l3u.de (mail.l3u.de [IPv6:2a01:4f8:1c1c:d482::1]) by gbr-app-1.alpinelinux.org (Postfix) with ESMTPS id 9F89B22363C for <~alpine/users@lists.alpinelinux.org>; Wed, 29 May 2024 18:23:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=stonemx.de; s=default; t=1717007010; bh=CfB/M1ckMs/jPt6zDau2SnQetP4c18IydpYdennxwEQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VswbpvgMkUNhG7SxpXFpx5FFG/8VCCeU6uujPE2eFcOx83Rs89V+/IhAg0A4qKBsV Y2+U14JPoPGrqrx6VSFVcVvb8j160NdDcqU4jKhCkCsnObL3jurm3Yr1Gq40m6jGAg LHOWDi/WmSbabUCVaA7+dZHZl3NqaSJ5GswVQq0fEYtXmNlHvw2QKQWiSYiv6m7IEZ DTYPLRHqt32LXF2n0mBRZEwh8P54iOSnhEgh9x78m8vyH8gBPflX0q5D8cR+H+o7rK 9qsFAkQ8KxmRb8BQZxlNpt/xth8i/bfGpAq2iepiUi7Ii/w+a5mlgIp4LOVi0i+N3e WERgjqrgnz4KA== Received: from ginuog.localnet (p200300e7a7170500a8e730fffe3150ed.dip0.t-ipconnect.de [IPv6:2003:e7:a717:500:a8e7:30ff:fe31:50ed]) by mail.l3u.de (Postfix) with ESMTPSA id 17E0BFF083 for <~alpine/users@lists.alpinelinux.org>; Wed, 29 May 2024 20:23:30 +0200 (CEST) From: Tobias Leupold To: ~alpine/users@lists.alpinelinux.org Subject: Re: ash and su/su - Date: Wed, 29 May 2024 20:23:29 +0200 Message-ID: <4151433.6PsWsQAL7t@ginuog> In-Reply-To: References: <1926392.IobQ9Gjlxr@ginuog> <2369059.BjyWNHgNrj@ginuog> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" E-Mail von juef vom Mittwoch, 29. Mai 2024, 14:20:57 CEST: > Hi, > > (Wed, 29 May 12:42) Tobias Leupold: > > When I do a plain "su", I get a prompt that would be defied as "\w #". > > Where is that defined?! It neither matches /etc/profile, nor the PS1 > > definition in my user's ~/.profile, nor the one in /root/.profile ... > > It's probably here: > https://git.busybox.net/busybox/tree/shell/ash.c?id=c5a1be25ba6dd705382ce6c2 > 5d96a32f79974c04#n2316 > > also see: > https://git.busybox.net/busybox/tree/shell/ash.c?id=c5a1be25ba6dd705382ce6c2 > 5d96a32f79974c04#n14757 > > if you define ENV, than it will load, i.e.: > cat /tmp/test-env > PS1="\u@\h:\w # " > > export ENV=/tmp/test-env Hey, thanks for the hint! I managed to get what I want using the ENV variable: I created /etc/profile.d/99local.sh, only containing export ENV="/etc/local-env" and said file containing the aliases I want and the PS1 definition: if [[ "$(whoami)" == "root" ]]; then PS1="\[\033]0;\u@\h:\W\007\]\[\033[01;31m\]\h\[\033[01;34m\] \W #\ [\033[00m\] " else PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \$\[\033[00m\] " fi alias ls="ls -h --color=auto" alias ll="ls -l" alias vi="vim" Now, this file is both sourced when I log in, and also when I do a plain "su". Thus, I always get my nice PS1 and my aliases :-) Nice! Thanks again! Cheers, Tobias