14

when I type:

at now + 1 min
at>play /usr/share/sounds/startrek.wav
at>ctrl+d

it works, so after one minute there is actually a sound played.

but, when I type:

at now + 1 min
at>echo "Teresa the green vegetable lover"
at>ctrl+d

I got no error response from the shell, but after 1 minute there is also no text displayed.

22

Commands run by at don't run in the terminal where they were registered. This wouldn't make sense in general: the terminal might not exist any more, or it might be in use by a different user. You may even have logged out by the time the command runs.

Output from an at command is sent to you by email. That's local Unix email, not whatever external POP or IMAP account you may have set up in some email program. If your local email is not set up, the output from the command is lost. If your local email isn't set up, this guide may help you.

If you want an at command to interact with your terminal, you need to use an explicit redirection. For example:

echo "echo hello >$TTY" | at now + 1 min

Note that in this snippet, the variable TTY is expanded by the shell, so the input to at is something like echo hello >/dev/pts/42.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.