Danny, On Wednesday 04 August 2004 13:22, Danny Sauer wrote:
...
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 $@... :)
Yup. One good SNAFU deserves another... Since programming is a practice well served by the persnickety, I'll make one final revision: echo "$0" "$@" |at now + 18 hours
--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. ;)
I'm not sure about all shells, but BASH allows multi-line, unescaped strings on the command line and in scripts. I also find BASH's $'C-style escape codes expanded in this kind of string' feature very handy. It's described in the "QUOTING" section of the BASH manual page.
--Danny
Randall Schulz