Use builtin string manipulation instead. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- scripts/make-erofs.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/make-erofs.sh b/scripts/make-erofs.sh index 82d37573ad0454e79becfddd05f93585df7b671c..ac62a65f53e0b6417b164f475a537960fc5203bc 100755 --- a/scripts/make-erofs.sh +++ b/scripts/make-erofs.sh @@ -40,7 +40,13 @@ while read -r arg1; do continue fi - parent=$(dirname "$arg2") + # The below simple version of dirname(1) can only handle + # a subset of all paths, but this subset includes all of + # the ones passed in practice other than /. + case $arg2 in + (*/*) parent=${arg2%/*};; + (*) parent=.;; + esac mkdir -p -- "$root/$parent" cp -RT -- "$arg1" "$root/$arg2" done -- 2.51.0