#!/bin/sh . $HOME/.bin/_config RPATH=/home/sdk/make-web/src/paste SSH="sdk@home.codevoid.de" WEB="https://home.codevoid.de/paste" f="$1" if [ "$1" = "-h" ]; then printf "Usage:\n" printf " paste < text.txt - read from stdin, generate filename\n" printf " paste new.txt < file.txt - read from stdin with filename\n" printf " paste file.txt - upload file as is\n" return 0 fi if [ -z "$1" ]; then f="$(date +"%Y-%m-%d_%M-%S")-$(pwgen -1 4 -A -0).txt" ssh ${SSH} "printf \"%s\" \"$(cat)\" > ${RPATH}/$f" elif [ -f "$f" ]; then scp "$f" ${SSH}:"${RPATH}/${f##*/}" else ssh ${SSH} "printf \"%s\n\" \"$(cat)\" > ${RPATH}/${f##*/}" fi ssh sdk@home.codevoid.de "cd ~/make-web && make install" printf "${WEB}/${f##*/}\n" printf "${WEB}/${f##*/}" | xclip [ -z $DISPLAY ] || notify-send "$(xclip -o)"