aboutsummaryrefslogtreecommitdiffstats
path: root/bash_include
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2012-01-09 23:43:39 +0800
committerLAN-TW <lantw44@gmail.com>2012-01-09 23:43:39 +0800
commit22cac80359f0f58a2ef2e4b55b0daeca1dc0e074 (patch)
tree89e63effc41126c5fa639515d147e2affe9562b1 /bash_include
parentfe0d42f3ef3376f1af3c30499e57ace338134bf3 (diff)
downloadconfigfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.tar
configfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.tar.gz
configfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.tar.bz2
configfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.tar.lz
configfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.tar.xz
configfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.tar.zst
configfile-22cac80359f0f58a2ef2e4b55b0daeca1dc0e074.zip
bash_include: 以更可靠的方式得知是否為互動式 shell、超級使用者提醒功能bash_include-20120109
Diffstat (limited to 'bash_include')
-rw-r--r--bash_include15
1 files changed, 11 insertions, 4 deletions
diff --git a/bash_include b/bash_include
index 8561a65..dbb94a4 100644
--- a/bash_include
+++ b/bash_include
@@ -1,14 +1,15 @@
#!/bin/bash
#
-# <lantw44>
+# /home/lantw44/.bash_include
#
# -- UTF-8 --
#
-if tty -s; then interactive_shell=1; fi
+#### if tty -s; then interactive_shell=1; fi
+if [ "`echo "$-" | grep "i" `" ]; then interactive_shell=1; fi
[ "$interactive_shell" ] && echo "Running .bash_include"
-[ "$interactive_shell" ] && default_tty_setting=`stty -g`
+[ "$interactive_shell" ] && default_tty_setting="`stty -g`"
# Internal Variables
@@ -794,5 +795,11 @@ shopt -s checkhash
shopt -s cmdhist
shopt -s mailwarn
-[ "$interactive_shell" ] && echo "Done"
+[ "$interactive_shell" ] && {
+ echo "Done"
+ if [ "$UID" = "0" ] || [ "$EUID" = "0" ]
+ then
+ printf "\nNote: You may be \e[1;32mprivileged\e[m now!\n\n"
+ fi
+}