]> gitweb @ CieloNegro.org - autobuild.git/blobdiff - lib/run.bash
Split the script to several files.
[autobuild.git] / lib / run.bash
diff --git a/lib/run.bash b/lib/run.bash
new file mode 100644 (file)
index 0000000..b68dc33
--- /dev/null
@@ -0,0 +1,18 @@
+function run () {
+    if (( $# == 0 )); then
+        echo "run: Usage: run CMD [ARG...]" >&2
+        return 1
+    fi
+
+    # Is the /dev/stdout opened to a tty?
+    if [[ -t 1 ]]; then
+        # Bold + Green
+        echo -ne "\e[1;32m"
+        echo "$@"
+        echo -ne "\e[0m"
+    else
+        echo "$@"
+    fi
+
+    $@
+}