diff options
author | Peter Palfrader <peter@palfrader.org> | 2012-03-10 13:28:27 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2012-03-10 13:28:27 +0000 |
commit | ada941728ee4b2cc602fabfac421e5c40cc7105e (patch) | |
tree | d8a8b926b409a8d12c179ace73fde2aa09a8b36f | |
parent | b783ab1ade3ebe44de6c34ee7083c9d3a8ff545e (diff) |
Allow naming of stdin
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@499 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-x | publish | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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 |