summaryrefslogtreecommitdiff
path: root/examples/xmlstarlet.msys
diff options
context:
space:
mode:
Diffstat (limited to 'examples/xmlstarlet.msys')
-rw-r--r--examples/xmlstarlet.msys21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/xmlstarlet.msys b/examples/xmlstarlet.msys
new file mode 100644
index 0000000..1d7c7f2
--- /dev/null
+++ b/examples/xmlstarlet.msys
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+xml="$1"
+shift
+
+# MSYS does unix -> windows path conversion if there is a leading /
+# but not when the argument contains a semicolon, eg: /x ->
+# C:\Mingw\msys\1.0\x so we double all leading /'s to avoid this
+
+nargs=$#
+args=()
+for ((i = 0; i < nargs; i++)) ; do
+ if [[ "$1" = /* ]] && [[ "$1" != *\;* ]] ; then
+ args[$i]="/$1"
+ else
+ args[$i]="$1"
+ fi
+ shift
+done
+
+exec "$xml" "${args[@]}"