]> gitweb.fluxo.info Git - scripts.git/commitdiff
Adds lpr-ssh
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 1 Apr 2016 16:42:57 +0000 (13:42 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 1 Apr 2016 16:42:57 +0000 (13:42 -0300)
lpr-ssh [new file with mode: 0755]

diff --git a/lpr-ssh b/lpr-ssh
new file mode 100755 (executable)
index 0000000..cf7db82
--- /dev/null
+++ b/lpr-ssh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# LPR over SSH.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+SERVER="$1"
+
+# Shift
+shift
+
+# Check
+if [ -z "$1" ]; then
+  echo "usage: $BASENAME <server> <file>"
+  exit 1
+elif [ ! -e "$*" ]; then
+  echo "no such file: $*"
+  exit 1
+fi
+
+# Proceed
+cat "$*" | ssh $SERVER lpr