Basic support of shell aliases
authorFrederic Massart <fred@moodle.com>
Mon, 18 Feb 2013 08:25:25 +0000 (16:25 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 18 Feb 2013 08:25:25 +0000 (16:25 +0800)
moodle

diff --git a/moodle b/moodle
index 95eb103..c33c314 100755 (executable)
--- a/moodle
+++ b/moodle
@@ -53,6 +53,12 @@ ALIAS=`$BIN show $COMMAND`
 
 if [ -n "$ALIAS" ]
 then
+    # It's a shell command.
+    if [[ ${ALIAS:0:1} == '!' ]]; then
+        ${ALIAS:1}
+        exit $?
+    fi
+    # If we're here, it's not a shell command. Let's parse the command and arguments.
     COMMAND=`echo $ALIAS | cut -d ' ' -f 1`
     ALIASARGS=`echo $ALIAS | cut -d ' ' -s -f 2-`
     ARGS="$ALIASARGS $ARGS"