penguin/utils

my env utils

commit 7257ab62bc715eb00094f75f9d23b3b96dc5d9f2

author斟酌 鵬兄 <tgckpg@gmail.com>
date2024-04-11T17:11:55Z
subjectShow admin symbol in cygwin
commit 7257ab62bc715eb00094f75f9d23b3b96dc5d9f2
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2024-04-11T17:11:55Z

    Show admin symbol in cygwin
---
 bash/rbashrc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/bash/rbashrc b/bash/rbashrc
index 5052518..b1b62fb 100644
--- a/bash/rbashrc
+++ b/bash/rbashrc
@@ -290,7 +290,17 @@ function r2dissource {
 	rm -r "$_dis" "$RBASH_SOURCES"
 }
 
-export PS1="This is ${RHOSTNAME}\e[1;3${RCOLOR}m${RDOMAIN}\e[0m: \w\n\$ "
+_SHELLD="\$"
+case $OSTYPE in
+	cygwin)
+		net session > /dev/null 2>&1
+		if [ $? -eq 0 ]; then
+			_SHELLD="#"
+		fi
+		;;
+esac
+
+export PS1="This is ${RHOSTNAME}\e[1;3${RCOLOR}m${RDOMAIN}\e[0m: \w\n$_SHELLD "
 export EDITOR=vim
 export PATH="$RBASH_BIN:$PATH"