dotfiles/.bin/upload

25 lines
609 B
Plaintext
Raw Normal View History

#!/bin/sh -e
if [ x"$1" == x"rm" ]
then
shift
for file in $@
do
ssh sdk@codevoid.de "cd /home/www/htdocs/ptrace/paste/ && rm -v $(basename "$file")" || true
done
elif [ x"$1" == x"ls" ]
then
shift
ssh sdk@codevoid.de "cd /home/www/htdocs/ptrace/paste/ && ls -1 | xargs -n1 -I{} echo https://ptrace.org/{}"
else
for file in $@
do
chmod o+rw,g+r "$file"
scp "$file" sdk@codevoid.de:/home/www/htdocs/ptrace/paste/
echo "https://ptrace.org/$(basename "$file")" \
| sed 's/ /%20/g' \
| xclip -f -r
echo
done
fi