/etc/zsh/zshrc: added bk() to backup a file with iso time tagged
[grml-etc-core.git] / etc / zsh / zshrc
index 4555b7a..a13720a 100644 (file)
@@ -809,7 +809,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
   alias term2iso="echo 'Setting terminal to iso mode' ; print -n '\e%@'"
   alias term2utf="echo 'Setting terminal to utf-8 mode'; print -n '\e%G'"
 
-  unalias utf2iso # make sure it is not assigned yet
+  type utf2iso &>/dev/null && unalias utf2iso # make sure it is not assigned yet
   utf2iso() {
     if isutfenv ; then
        for ENV in $(env | command grep -i '.utf') ; do
@@ -818,7 +818,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
      fi
   }
 
-  unalias iso2utf # make sure it is not assigned yet
+  type iso2utf &>/dev/null && unalias iso2utf # make sure it is not assigned yet
   iso2utf() {
    if ! isutfenv ; then
       for ENV in $(env | command grep -i '\.iso') ; do
@@ -1502,6 +1502,11 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
     exec env -i ENV="/etc/minimal-shellrc" HOME="$HOME" TERM="$TERM" ksh
   }
 
+  # make a backup of a file
+  bk() {
+    cp -a "$1" "${1}_$(date --iso-8601=seconds)"
+  }
+
   # Switching shell safely and efficiently? http://www.zsh.org/mla/workers/2001/msg02410.html
   # bash() {
   #  NO_SWITCH="yes" command bash "$@"