pthbs-copy-to-logdir (457B)
1 #!/bin/sh -e 2 if test -n "$pthbs_xtrace"; then 3 set -x 4 if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi 5 fi 6 dstdir=${1%/} 7 8 if ! test -d "$dstdir"; then 9 printf '%s\n' "$0: Error: invalid destination directory" 10 exit 1 11 fi 12 13 for srcfile in "$@"; do 14 case "$srcfile" in 15 (/*) ;; 16 (./*) ;; 17 (*) srcfile="./$srcfile" ;; 18 esac 19 dstfile=$(s6-uniquename "$dstdir/$(basename "$srcfile")") 20 cp -v "$srcfile" "$dstfile" || exit $? 21 done