diff options
-rw-r--r-- | doc/functions.txt | 8 |
1 files 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" } |