/etc/zsh/zshrc: check for $SUDO and do not use it when running as root
[grml-etc-core.git] / etc / zsh / zshrc
index 9f5b88e..d6b9938 100644 (file)
@@ -3,7 +3,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Son Apr 22 18:37:24 CEST 2007 [mika]
+# Latest change: Son Apr 29 13:16:44 CEST 2007 [mika]
 ################################################################################
 # This file is sourced only for interactive shells. It
 # should contain commands to set up aliases, functions,
@@ -235,6 +235,7 @@ fi
    'fbmplayer' 'mplayer -vo -fs -zoom fbdev'
    'fblinks' 'links2 -driver fb'
    'insecssh' 'ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
+   'insecscp' 'scp -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
    'fori' 'for i ({..}) { }'
    'cx' 'chmod +x'
    'e'  'print -l'
@@ -624,6 +625,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
        unsetopt prompt_cr
        export PS1="%m%# "
        nice -n -20 speechd-up
+       sleep 2
        flite -o play -t "Finished setting up software synthesizer"
     fi
   '
@@ -694,12 +696,12 @@ Enjoy your grml system with the zsh!$reset_color"
     alias acs='apt-cache search'
     alias acsh='apt-cache show'
     alias acp='apt-cache policy'
-    alias adg="$SUDO apt-get dist-upgrade"
-    alias agi="$SUDO apt-get install"
-    alias ati="$SUDO aptitude install"
-    alias ag="$SUDO apt-get upgrade"
-    alias au="$SUDO apt-get update"
-    alias up="$SUDO aptitude update ; $SUDO aptitude upgrade"
+    [ -n "$SUDO" ] && alias adg="$SUDO apt-get dist-upgrade" || alias adg="apt-get dist-upgrade"
+    [ -n "$SUDO" ] && alias agi="$SUDO apt-get install"      || alias agi="apt-get install"
+    [ -n "$SUDO" ] && alias ati="$SUDO aptitude install"     || alias ati="aptitude install"
+    [ -n "$SUDO" ] && alias ag="$SUDO apt-get upgrade"       || alias ag="apt-get upgrade"
+    [ -n "$SUDO" ] && alias au="$SUDO apt-get update"        || alias au="apt-get update"
+    [ -n "$SUDO" ] && alias up="$SUDO aptitude update ; $SUDO aptitude upgrade" || alias up="aptitude update ; aptitude upgrade"
     alias dbp='dpkg-buildpackage'
     alias ge='grep-excuses'
 
@@ -1150,6 +1152,17 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
   }
   functions peval &>/dev/null && alias calc=peval
 
+  # brltty seems to have problems with utf8 environment and/or font Uni3-Terminus16 under
+  # certain circumstances, so work around it, no matter which environment we have
+  brltty() {
+    if [ -z "$DISPLAY" ] ; then
+       consolechars -f /usr/share/consolefonts/default8x16.psf.gz
+       command brltty "$@"
+    else
+       command brltty "$@"
+    fi
+  }
+
   # Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
   # bash() {
   #  NO_SWITCH="yes" command bash "$@"