Skip to content

Commit 700c7a8

Browse files
author
Michał Górny
committed
Fix dash compatibility.
1 parent 23ce7e4 commit 700c7a8

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RULESDIR = /etc/udev/rules.d
77

88
# End of simple config, you shall not pass below
99

10-
VERSION = 0.0.2
10+
VERSION = 0.0.2_p1
1111

1212
BUILDDIR = build
1313
SRCDIR = src

src/uam-common.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@ mp_remove() {
196196
fi
197197
}
198198

199+
# Count slashes in arg and increase ${DEPTH} if needed
200+
201+
_mp_countslashes() {
202+
local MP
203+
MP="$(echo "$1" | tr -cd /)"
204+
[ ${#MP} -gt ${DEPTH} ] && DEPTH=${#MP}
205+
206+
return 0
207+
}
208+
199209
# Calculate -maxdepth for given templates.
200210

201211
mp_getmaxdepth() {
@@ -205,15 +215,7 @@ mp_getmaxdepth() {
205215

206216
if ! isint "${DEPTH}"; then
207217
DEPTH=0
208-
function mp_countslashes() {
209-
local MP
210-
MP="$(echo "$1" | tr -cd /)"
211-
[ ${#MP} -gt ${DEPTH} ] && DEPTH=${#MP}
212-
213-
return 0
214-
}
215-
216-
foreach "${ARR}" mp_countslashes
218+
foreach "${ARR}" _mp_countslashes
217219
fi
218220

219221
echo $(( DEPTH + 1 ))

0 commit comments

Comments
 (0)