#!/bin/bash copyResult=`scp "$3" username@server:printUpload.pdf 2>&1` if [ -n "$copyResult" ]; then osascript -e 'tell application "Finder"' -e "activate" \ -e "display dialog \"scp wanted to talk to you:\\r$copyResult\" \ buttons {\"OK\"} default button 1" \ -e 'end tell' exit 1 fi deleteResult=`rm -f "$3" 2>&1` if [ -n "$deleteResult" ]; then osascript -e 'tell application "Finder"' -e "activate" \ -e "display dialog \"Something may have gone wrong when\rdeleting the temp file:\\r$deleteResult\" \ buttons {\"OK\"} default button 1" \ -e 'end tell' exit 2 fi printResult=`ssh username@server -n "lpr printUpload.pdf; sleep 1; rm printUpload.pdf" 2>&1` if [ -n "$printResult" ]; then quote=$'\047' osascript -e 'tell application "Finder"' -e "activate" \ -e "display dialog \"Server${quote}s lpr wanted to talk to you:\\r\\r$printResult\" \ buttons {\"OK\"} default button 1" \ -e 'end tell' exit 3 fi