]> arthur.barton.de Git - ConfigScripts.git/blobdiff - sys/profile
Only update ~/.last_reminder when reminders have been shown
[ConfigScripts.git] / sys / profile
index 1f361a1aadfffedfb91119561684a60153a8f339..f6e5aeef36d935f418e18484bf15b96fb0b01a22 100644 (file)
@@ -13,9 +13,9 @@ export PROFILEREAD
 
 # Setup locale and encoding
 if [ -e ~/.ConfigScripts.debug ]; then
-       echo " - TERM=\"$TERM\""
-       echo " - LANG=\"$LANG\""
-       echo " - LC_CTYPE=\"$LC_CTYPE\""
+       echo "     - TERM=\"$TERM\""
+       echo "     - LANG=\"$LANG\""
+       echo "     - LC_CTYPE=\"$LC_CTYPE\""
 fi
 # Does LC_CTYPE or LANG indicate an UTF-8 terminal?
 LC_encoding=""
@@ -32,11 +32,11 @@ if [ -z "$LC_encoding" ]; then
                        LC_encoding="ISO8859-1"
        esac
 fi
-[ -e ~/.ConfigScripts.debug ] && echo " - LC_encoding=\"$LC_encoding\" (temp)"
+[ -e ~/.ConfigScripts.debug ] && echo "     - LC_encoding=\"$LC_encoding\" (temp)"
 # Set locale if it is not set or doesn't contain a dot:
 [ "$LANG" = "${LANG#*.}" -a "$LANG" != "C" ] \
        && export LANG="${LANG:-de_DE}.${LC_encoding}"
-[ -e ~/.ConfigScripts.debug ] && echo " - LANG=\"$LANG\" (new)"
+[ -e ~/.ConfigScripts.debug ] && echo "     - LANG=\"$LANG\" (new)"
 # Clean up ...
 unset LC_CTYPE LC_encoding 2>/dev/null
 
@@ -183,6 +183,10 @@ case "$-" in
        *) return ;;
 esac
 
+# Use "xterm-256color" for xterm's (and the like) when it is available
+[ "$TERM" = "xterm" -a -r "/usr/share/terminfo/x/xterm+256color" ] \
+       && export TERM="xterm-256color"
+
 # validate terminal definition
 type -t tset >/dev/null && eval `tset -s -Q`
 
@@ -193,8 +197,8 @@ type -t tset >/dev/null && eval `tset -s -Q`
 
 # Reminders (once every 60 minutes)
 if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
-       [ -e ~/.ConfigScripts.debug ] && echo " - Reminders ..."
-       if [ "$(type -t icalBuddy >/dev/null)" -a "$LOGNAME" != "root" ]; then
+       [ -e ~/.ConfigScripts.debug ] && echo "     - Reminders ..."
+       if [ "$(type -t icalBuddy 2>/dev/null)" -a "$LOGNAME" != "root" ]; then
                # icalBuddy(1)
                case "$LANG" in
                        *.UTF*) bul="•"; bul_imp="!"; sep="»"; ;;
@@ -208,15 +212,16 @@ if [ -z `find ~/.last_reminder -mmin -60 2>/dev/null` ]; then
                        eventsToday+1 2>/dev/null
                [ $? -eq 0 ] && echo
                unset bul bul_imp sep
+               [ -w ~/ ] && touch ~/.last_reminder
        else
                # remind(1)
-               if [ "$(type -t remind >/dev/null)" -a -r ~/.remind ]; then
+               if [ "$(type -t remind 2>/dev/null)" -a -r ~/.remind ]; then
                        remind -h -g -t5 ~/.remind | \
                                grep -v '^Reminders for ' | grep -v '^$'
                        [ $? -eq 0 ] && echo
                fi
+               [ -w ~/ ] && touch ~/.last_reminder
        fi
-       [ -w ~/ ] && touch ~/.last_reminder
 fi
 
 # bash-specific initialization