summaryrefslogtreecommitdiff
path: root/examples/xmlstarlet.msys
blob: 1d7c7f28423924bb9687551fb6fcba8b27e2a16b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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[@]}"