Randall wrote regarding 'Re: [SLE] Pullin' my hair out... arrrgh' on Wed, Aug 04 at 13:33:
Danny,
On Wednesday 04 August 2004 11:15, Danny Sauer wrote:
Anders wrote regarding 'Re: [SLE] Pullin' my hair out... arrrgh' on Wed, Aug 04 at 12:50:
...
Is there a cleaner way of doing this?
finish the script with something like
cat << EOF |at now + 18 hours /usr/bin/scriptname EOF
I'm partial to
echo $0 | at now + 18 hours
You probably want this:
echo "$@" |at now + 18 hours
The quotes are always advisable and should there be any arguments, presumably you'd want them passed on as well.
Doh! Yes, quotes should be there, in case the programs's named '-n' or something bizarre like that. We're both wrong, though. I meant echo "$0 $@" | at now + 18 hours $0 is the command $@ is the args both are needed - though my $0 would've worked better alone than your $@... :)
--Danny, who also dislikes here documents, in general
Here documents are cool, but they make scripts harder to read and understand, so I avoid using them unless they're really necessary.
When they're cool, I like them too. In general, they're not cool, though, since I use perl more than shells for scripting, and it's easier to just leave a pair of quotes open for multi-line strings in most cases. ;) --Danny