19 lines
440 B
Bash
19 lines
440 B
Bash
|
|
printer=OfficeJet
|
||
|
|
proxy=zaatar
|
||
|
|
|
||
|
|
remote_temporary_directory=$(ssh "$proxy" 'mktemp -d')
|
||
|
|
clean() {
|
||
|
|
ssh "$proxy" "rm -rf $remote_temporary_directory"
|
||
|
|
}
|
||
|
|
trap clean EXIT
|
||
|
|
|
||
|
|
for file in $@; do
|
||
|
|
if [ -f "$file" ]; then
|
||
|
|
rsync "$file" "$proxy:$remote_temporary_directory"
|
||
|
|
ssh "$proxy" lpr -P "$printer" "$remote_temporary_directory/$(basename "$file")"
|
||
|
|
else
|
||
|
|
echo Skipping non-file "$file" >&2
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
ssh "$proxy" lpq -P "$printer"
|