From ac157ebc5a8450b7431ec60062a0f294a939b587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 10 Dec 2019 12:24:34 +0100 Subject: shellrc: add prompt for ash --- shellrc/APKBUILD | 3 ++- shellrc/prompt.sh | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 shellrc/prompt.sh (limited to 'shellrc') diff --git a/shellrc/APKBUILD b/shellrc/APKBUILD index a60f9c6..c281eb4 100644 --- a/shellrc/APKBUILD +++ b/shellrc/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Karel Kočí pkgname=shellrc pkgver=0.7.5 -pkgrel=1 +pkgrel=2 pkgdesc="Shell initialization files" url="https://git.cynerd.cz/shellrc/" arch="noarch" @@ -13,6 +13,7 @@ options="!check" package() { "$builddir/install" --prefix "$pkgdir" + cp prompt.sh "$pkgdir/etc/profile.d/prompt.sh" } zsh() { diff --git a/shellrc/prompt.sh b/shellrc/prompt.sh new file mode 100755 index 0000000..7a857da --- /dev/null +++ b/shellrc/prompt.sh @@ -0,0 +1,12 @@ +# Better prompt +case "$TERM" in + xterm*|rxvt*) + export PS1='$(EC=$? +[ $EC = 0 ] || echo -n "\e[1;33m$EC:" +if [ `id -u` -eq "0" ]; then + echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] " +else + echo -n "\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " +fi)' + ;; +esac -- cgit v1.2.3