#!/bin/sh
#grab oldest file from queue
stuff=\`ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1\`
#pull printer name from lp requests (first line in file)
puff=\`cat $stuff | /usr/bin/head -1 | sed -e 's/-.*//' -e 's/$/ is having issues printing from /'\`
if [ "$(ls -A /var/spool/lp/requests/localhost/)" ]
then
echo $puff | /usr/ucb/mail [email protected]
else
echo lp queue is empty | /usr/ucb/mail [email protected]
fi
Works fine as a shell script; cron cannot cat $stuff
edit2: changed these 2, same result
stuff="(ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1)"
puff="$(cat $stuff | /usr/bin/head -1 | sed -e 's/-.*//' -e 's/$/ is having issues printing from /)"
stuff=\\`ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1\\`
- it just emits-1: not found
with those escaped backticks in place. And Solarissh
does not support( )
as a replacement for backtick evaluation, sostuff="(ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1)"
merely sets thestuff
envval to the literal string(ls -1 /var/spool/lp/requests/localhost/ | /usr/bin/head -1)