Release new version 2.13.0
[grml-scripts.git] / usr_bin / caps-ctrl
index 8096e42..824ddd1 100755 (executable)
@@ -6,13 +6,19 @@
 # License:       This file is licensed under the GPL v2.
 ################################################################################
 
-if . /etc/grml/script-functions ; then
-   check4progs xmodmap loadkeys dumpkeys || exit 1
+if [[ -f /etc/grml/script-functions ]] ; then
+       source /etc/grml/script-functions && \
+       check4progs xmodmap loadkeys dumpkeys || exit 1
+fi
+if [[ -f /etc/grml/lsb-functions ]] ; then
+       source /etc/grml/lsb-functions
+else
+       einfo() { echo  "$*" ; }
+       eerror() { echo "$*" ; }
+       eend() { echo "$*" ; }
 fi
-. /etc/grml/lsb-functions || ( alias einfo=echo ; alias eerror=echo; alias eend=echo )
 
 emulate zsh
-autoload -U colors ; colors
 
 if [[ -z $DISPLAY  ]] ; then # test if X is not running when calling us
          if [ $(id -u) != 0 ] ; then # test if user root did invoke this command
@@ -25,8 +31,8 @@ if [[ -z $DISPLAY  ]] ; then # test if X is not running when calling us
          ( einfo "caps-ctrl - switching caps lock and control key."
 
            loadkeys <<- EOT
-           keycode 58 = `repeat 15 echo -n 'Control '`
-           keycode 29 = `repeat 7 echo -n 'Caps_Lock '`
+           keycode 58 = $(repeat 15 echo -n 'Control ')
+           keycode 29 = $(repeat 7 echo -n 'Caps_Lock ')
                EOT
            eend $?
 
@@ -34,8 +40,8 @@ if [[ -z $DISPLAY  ]] ; then # test if X is not running when calling us
           einfo "caps-ctrl - switching caps lock and control key."
 
            loadkeys <<- EOT
-           keycode 58 = `repeat 15 echo -n 'Caps_Lock '`
-           keycode 29 = `repeat 7 echo -n 'Control '`
+           keycode 58 = $(repeat 15 echo -n 'Caps_Lock ')
+           keycode 29 = $(repeat 7 echo -n 'Control ')
                EOT
            eend $?
          )