Re: Summary: problem using "at" in a shell script

From: Henrik Martin (
Date: Wed Jan 05 1994 - 06:56:17 CST (Mike Kopp) writes:

...text deleted...

>Thanks to several people it now works. The solution is to put the end ! at
>the beginning of the line, that is, this works:
>if [ `/bin/true` ]
> at -s now + ${NEW_TIME} minute <<!
> table.test 2>&1 | mail kopp

>Another respondent made the good suggestion to use something like EOF
>instead of !. This would be more clear.
>Mike Kopp
>Electronic Support Measures Laboratory
>Georgia Tech Research Institute

The way to go if you want to indent your "here document" is to use the
hyphen (-) as this:

if [ `/bin/true` ]; then
        at -s now + ${NEW_TIME} minute <<-EOF
        table.test 2>&1 | mail kopp

The hyphen tells the bourne shell not to bother about the heading tab
at the end of the here document.

By the way, why are you trying to use at recursively? Why not run the
script as a cron job and just terminate without doing anything in those
cases that your "certain condition" turns out to be false? Seems a lot
easier to mee :-)

Henrik Martin
Ellemtel Telecommunication Systems Laboratories Sweden
Office phone: + 46 8 727 36 04 Fax: + 46 8 647 82 76

Henrik Martin                     | 
Networked UNIX systems support    | "emacs is a fine operating system, 
Email: euamhk                     |  but I still prefer UNIX"
Tel  : 3604                       |

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:53 CDT