From 6295a9e619865ddd677c8677fce8cc2b405c9450 Mon Sep 17 00:00:00 2001 From: merakor Date: Sun, 24 May 2020 23:05:45 +0000 Subject: fix kinstall function FossilOrigin-Name: c7c516c066c0721159d2a2d00a5c772c369a4b68cb6a8457d61d44fbe0809af3 --- doc/functions.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/functions.txt b/doc/functions.txt index 965c778..0f8cd60 100644 --- a/doc/functions.txt +++ b/doc/functions.txt @@ -80,13 +80,11 @@ single file where it will be named as the argument. kinstall() { # usage: kinstall 755 /usr/bin/file filename - mod=$1 target=$2; mkdir -p "${target%/*}" - shift 2 - ! [ -d "$target" ] || { + ! [ -d "$2" ] || { printf '%s\n' "Error: $target is a directory" >&2 return 1 } - cp "$file" "$target" - chmod "$mod" "$target" + mkdir -p "${2%/*}"; cp "$3" "$2" + chmod "$1" "$2" } -- cgit v1.2.3