Use posix shell variable expansion substitution instead of subshells with sed

This commit is contained in:
Martin Storsjö committed 2018-10-08 14:13:42 +03:00
1 parent 0ec597b1bb
commit 818766d3d4
5 files changed
+18 -13

No files matched your search

+4 -3
View File
@@ -1,8 +1,9 @@
#!/bin/sh
DIR="$(cd "$(dirname "$0")" && pwd)"
TARGET="$(basename $0 | sed 's/-[^-]*$//')"
EXE=$(basename $0 | sed 's/.*-\([^-]*\)/\1/')
ARCH=$(echo $TARGET | sed 's/-.*//')
BASENAME="$(basename "$0")"
TARGET="${BASENAME%-*}"
EXE="${BASENAME##*-}"
ARCH="${TARGET%%-*}"
# Allow setting e.g. CCACHE=1 to wrap all building in ccache.
if [ -n "$CCACHE" ]; then