]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - examples/misc/aliasconv.sh
Imported from ../bash-3.0.tar.gz.
[thirdparty/bash.git] / examples / misc / aliasconv.sh
index 29e1ead9c5a4cf8d1be23606a8f5b3319d65d230..75db0778fb2dd038cbf7bb135f663e194c04b202 100755 (executable)
@@ -14,16 +14,16 @@ T=' '
 cat << \EOF >/tmp/cb$$.1
 mkalias ()
 {
-       if [ "x$2" = "x" ]; then
-               echo alias ${1}="''"
-       elif echo "$2" | egrep -s '(\!|#)' >/dev/null 2>&1; then
+       case $2 in
+       '')     echo alias ${1}="''" ;;
+       *[#\!]*)
                comm=`echo $2 | sed  's/\\!\*/"$\@"/g
                                      s/\\!:\([1-9]\)/"$\1"/g
                                      s/#/\#/g'`
                echo $1 \(\) "{" command "$comm"  "; }"
-       else
-               echo alias ${1}=\'`echo "${2}" | sed "s:':'\\\\\\\\'':"`\'
-       fi
+               ;;
+       *)      echo alias ${1}=\'`echo "${2}" | sed "s:':'\\\\\\\\'':"`\' ;;
+       esac
 }
 EOF