summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Ørsted Andresen <bo.andresen@zlin.dk>2007-02-28 12:31:42 +0000
committerBo Ørsted Andresen <bo.andresen@zlin.dk>2007-02-28 12:31:42 +0000
commite43ac7778780c10e68cf0254a6cde34b1b5d70ee (patch)
tree953030cf514164eeab8a148742e7a2c8343ac15e
parent52f3ffaff5437a2f8a3786ededb43a3fee7fdcca (diff)
downloadwgetpaste-e43ac7778780c10e68cf0254a6cde34b1b5d70ee.tar.gz
Now really add --xcut.
-rwxr-xr-xwgetpaste9
1 files changed, 7 insertions, 2 deletions
diff --git a/wgetpaste b/wgetpaste
index 941fde7..72df4c6 100755
--- a/wgetpaste
+++ b/wgetpaste
@@ -271,6 +271,11 @@ while [[ ! -z "${1}" ]]; do
echo "$0, version ${VERSION}"
exit 0
;;
+ -x | --xcut )
+ XCUT=true
+ SOURCE="xcut"
+ shift
+ ;;
*)
if [[ -f "${1}" ]]; then
SOURCE="${1}"
@@ -309,7 +314,7 @@ if [[ -z "${DESCRIPTION}" ]]; then
fi
# handle the case where the input source (defaulting to /dev/stdin) isn't readable verbosely
-if [[ ! -r "${SOURCE}" ]]; then
+if [[ ! ${XCUT} ]] && [[ ! -r "${SOURCE}" ]]; then
echo "The input source: \"${SOURCE}\" is not readable. Please specify a readable input source." 1>&2
echo 1>&2
show_usage 1>&2
@@ -333,7 +338,7 @@ if [[ ${XCUT} ]]; then
exit 1
fi
else
- INPUT="$(escape "$(<${SOURCE})")"
+ INPUT="$(escape "$( < "${SOURCE}" )")"
fi
[[ -z "${INPUT}" ]] && die "No input read. Nothing to paste. Aborting."