logo

sshpaste

Simple paste script to a server having SSH+HTTP daemons
commit: 4cad8325b8221097c8ecacd5f0f9fd8e2842acad
parent: 98115d0c204a33ad201b1e1bfafd800c8ef822f5
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat,  5 May 2018 06:30:56 +0200

sshpaste: No multiple options

Diffstat:

Msshpaste14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/sshpaste b/sshpaste @@ -47,10 +47,10 @@ sshpaste_command() { } sshpaste_usage() { - echo "Usage: ${1} [options] [file(s)]" >&2 + echo "Usage: ${1} [option] [file(s)]" >&2 echo 'Options:' >&2 - echo ' -x read input from clipboard (requires xclip)' >&2 echo ' -c COMMAND paste COMMAND and the output of COMMAND' >&2 + echo ' -x read input from clipboard (requires xclip)' >&2 } flag_x= @@ -59,12 +59,16 @@ temporary_file= while getopts "xc:" opt do case $opt in - 'x') - flag_x=1 - ;; 'c') + [ -z flag_x ] && die "Cannot have both -x and -c" + [ -z flag_c ] && die "Cannot have two -c, use ; if you want multiple commands" + flag_c=1 opt_command="${OPTARG}" ;; + 'x') + [ -z flag_c ] && die "Cannot have both -x and -c" + flag_x=1 + ;; '?') sshpaste_usage $0 exit 2