From ada941728ee4b2cc602fabfac421e5c40cc7105e Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 10 Mar 2012 13:28:27 +0000 Subject: Allow naming of stdin git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@499 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- publish | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/publish b/publish index e40ae33..b1d61d3 100755 --- a/publish +++ b/publish @@ -100,7 +100,7 @@ NODO="" inputxclip=0 do_screenshot=0 -while getopts "hnHSx" OPTION +while getopts "hnHSxs:" OPTION do case $OPTION in h) @@ -125,6 +125,9 @@ do S) do_screenshot=1 ;; + s) + name_stdin="$OPTARG" + ;; *) usage >&2 exit 1 @@ -162,7 +165,15 @@ if [[ "$#" = 0 ]]; then exit 1 fi fi - set dummy "$stdin" + if [ "${name_stdin%-}" != "" ]; then + tmpdir=`mktemp -d` + target="$tmpdir/$(basename "$name_stdin")" + mv "$stdin" "$target" + trap "rm -f '$target' && rmdir '$tmpdir'" EXIT + set dummy "$target" + else + set dummy "$stdin" + fi shift elif [ "$inputxclip" = 1 ] ; then echo "Ignoring -x because there are files on the command line" >&2 -- cgit v1.2.3