From 07ffea44abf0c1045c335ea1ba941b1bcc3bde60 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 25 Sep 2010 19:08:57 +0200 Subject: put: Support directories --- etc/functions/put | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'etc/functions') diff --git a/etc/functions/put b/etc/functions/put index 940c22c..aa99c63 100644 --- a/etc/functions/put +++ b/etc/functions/put @@ -53,12 +53,17 @@ while [[ ${1} == -* ]] { shift } -if [[ ! -f ${1} ]] { +if [[ ! -e ${1} ]] { echo "${1}: No such file" >&2 return 1 } -file=${1} +if [[ -d ${1} ]] { + tar -C ${1:h} -cJf /tmp/${1:t}.tar.xz ${1:t} + file=/tmp/${1:t}.tar.xz +} else { + file=${1} +} while (( ${#hosts} )) { remote_file=${file:t} -- cgit v1.2.3