Revert the b0rken type change for zsh
[grml-etc-core.git] / etc / zsh / zshrc
index 5a9a2a5..db7173f 100644 (file)
@@ -93,7 +93,7 @@
 # }}}
 
 # locale setup {{{
-  if [[ -n "$LANG" ]]  ; then
+  if [[ -n "$LANG" ]] ; then
      export LANG
   else
      [[ -r /etc/default/locale ]] && source /etc/default/locale
   export SHELL='/bin/zsh'
 
   # color setup for ls:
-  [[ -x $(type dircolors) ]] && eval `dircolors -b`
+  [[ -x $(which dircolors) ]] && eval `dircolors -b`
 
   # set width of man pages to 80 for more convenient reading
   # (( ${+MANWIDTH} )) || export MANWIDTH=80
@@ -325,7 +325,7 @@ fi
 
 # just type 'cd ...' to get 'cd ../..'
 #  rationalise-dot() {
-#  if [[ $LBUFFER = *.. ]] ; then
+#  if [[ $LBUFFER == *.. ]] ; then
 #    LBUFFER+=/..
 #  else
 #    LBUFFER+=.
@@ -633,7 +633,7 @@ fi
 
 # {{{ display battery status on right side of prompt via running 'BATTERY=1 zsh'
   if [[ -n "$BATTERY" ]] ; then
-     if [[ -x $(type acpi) ]] ; then
+     if [[ -x $(which acpi) ]] ; then
         PERCENT="${(C)${(s| |)$(acpi 2>/dev/null)}[4]}"
         [[ -z "$PERCENT" ]] && PERCENT='acpi not present'
         if [[ "${PERCENT%%%}" -lt 20 ]] ; then
@@ -843,7 +843,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
 # }}}
 
 # {{{ some aliases
-  if [[ $UID = 0 ]] ; then
+  if [[ $UID -eq 0 ]] ; then
      [[ -r /etc/grml/screenrc ]] && alias screen='/usr/bin/screen -c /etc/grml/screenrc'
   elif [[ -r $HOME/.screenrc ]] ; then
      alias screen="/usr/bin/screen -c $HOME/.screenrc"
@@ -852,7 +852,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
   fi
 
   # do we have GNU ls with color-support?
-  if ls --help 2>/dev/null |grep -- --color= >/dev/null && [[ "$TERM" != dumb ]] ; then
+  if ls --help 2>/dev/null | grep -- --color= >/dev/null && [[ "$TERM" != dumb ]] ; then
      #a1# execute \kbd{@a@}:\quad ls with colors
      alias ls='ls -b -CF --color=auto'
      #a1# execute \kbd{@a@}:\quad list all files, with colors
@@ -875,7 +875,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
   alias ...='cd ../../'
 
   # generate alias named "$KERNELVERSION-reboot" so you can use boot with kexec:
-  if [[ -x /sbin/kexec -a -r /proc/cmdline ]] ; then
+  if [[ -x /sbin/kexec ]] && [[ -r /proc/cmdline ]] ; then
      alias "$(uname -r)-reboot"="kexec -l --initrd=/boot/initrd.img-"$(uname -r)" --command-line=\"$(cat /proc/cmdline)\" /boot/vmlinuz-"$(uname -r)""
   fi
 
@@ -940,7 +940,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
   alias top10='print -l ? ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
 
 # truecrypt; use e.g. via 'truec /dev/ice /mnt/ice' or 'truec -i'
-  if [[ -x $(type truecrypt) ]] ; then
+  if [[ -x $(which truecrypt) ]] ; then
      if isutfenv ; then
         alias truec='truecrypt --mount-options "rw,sync,dirsync,users,uid=1000,gid=users,umask=077,utf8" '
      else
@@ -1052,14 +1052,14 @@ Enjoy your grml system with the zsh!$reset_color"
   fi
 
 # sort installed Debian-packages by size
-  if [[ -x $(type grep-status) ]] ; then
+  if [[ -x $(which grep-status) ]] ; then
      #a3# List installed Debian-packages sorted by size
      alias debs-by-size='grep-status -FStatus -sInstalled-Size,Package -n "install ok installed" | paste -sd "  \n" | sort -rn'
   fi
 
 # if cdrecord is a symlink (to wodim) or isn't present at all warn:
-  if [[ -L /usr/bin/cdrecord -o ! -x $(type cdrecord) ]] ; then
-     if [[ -x $(type wodim) ]] ; then
+  if [[ -L /usr/bin/cdrecord || ! -x $(which cdrecord) ]] ; then
+     if [[ -x $(which wodim) ]] ; then
         alias cdrecord="echo 'cdrecord is not provided under its original name by Debian anymore.
 See #377109 in the BTS of Debian for more details.
 
@@ -1068,7 +1068,7 @@ Please use the wodim binary instead' ; return 1"
   fi
 
 # get_tw_cli has been renamed into get_3ware
-  if [[ -x $(type get_3ware) ]] ; then
+  if [[ -x $(which get_3ware) ]] ; then
      get_tw_cli() {
        echo 'Warning: get_tw_cli has been renamed into get_3ware. Invoking get_3ware for you.'>&2
        get_3ware
@@ -1076,7 +1076,7 @@ Please use the wodim binary instead' ; return 1"
   fi
 
 # I hate lacking backward compatibility, so provide an alternative therefore
-  if ! [[ -x $(type apache2-ssl-certificate) ]] ; then
+  if ! [[ -x $(which apache2-ssl-certificate) ]] ; then
      apache2-ssl-certificate(){
 
      print 'Debian does not ship apache2-ssl-certificate anymore (see #398520). :('
@@ -1165,7 +1165,7 @@ grmlcomp() {
           _last_try="$HISTNO$BUFFER$CURSOR"
           reply=(_complete _match _ignored _prefix _files)
         else
-          if [[ $words[1] = (rm|mv) ]] ; then
+          if [[ $words[1] == (rm|mv) ]] ; then
             reply=(_complete _files)
           else
             reply=(_oldlist _expand _force_rehash _complete _ignored _correct _approximate _files)
@@ -1266,19 +1266,19 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
     fi
   }
 
-  if [[ -x $(type 915resolution) ]] ; then
+  if [[ -x $(which 915resolution) ]] ; then
      alias 855resolution='echo -e "Please use 915resolution as resolution modify tool for Intel graphic chipset."; return -1'
   fi
 
   #a1# Output version of running grml
   alias grml-version='cat /etc/grml_version'
 
-  if [[ -x $(type rebuildfstab) ]] ; then
+  if [[ -x $(which rebuildfstab) ]] ; then
      #a1# Rebuild /etc/fstab
      alias grml-rebuildfstab='rebuildfstab -v -r -config'
   fi
 
-  if [[ -x $(type grml-debootstrap) ]] ; then
+  if [[ -x $(which grml-debootstrap) ]] ; then
      alias debian2hd='print "Installing debian to harddisk is possible via using grml-debootstrap." ; return 1'
   fi
 }
@@ -1352,7 +1352,7 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
      # manzsh()  { man zshall | $MYLESS -p $1 ; }
   fi
 
-  if [[ -x $(type most) ]] ; then
+  if [[ -x $(which most) ]] ; then
   #f1# View Debian's changelog of a given package
     dchange() {
       if [[ -r /usr/share/doc/${1}/changelog.Debian.gz ]] ; then