dotfiles/.config/zsh/functions/putwww

23 lines
431 B
Plaintext
Raw Normal View History

2022-03-19 06:27:22 +01:00
#!/usr/bin/env zsh
# Put files on a webspace via sftp
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
2022-04-03 06:43:18 +02:00
autoload -U die
[[ ${ARGC} -eq 0 ]] && die 1 "Usage: ${0} <file> …"
2022-03-19 06:27:22 +01:00
local -a putcmds
for file in "${@}"; do
putcmds+="put ${file}"
done
sftp tastytea.de <<EOF
cd /var/www/tastytea.de/files/
$(print -l ${putcmds})
EOF
for file in "${@}"; do
print '\e[1;95m→\e[0m' https://tastytea.de/files/"${file##*/}"
done