Why does the echo command do not work with at command?
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
.
Related videos on Youtube
Abdul Al Hazred
Updated on September 18, 2022Comments
-
Abdul Al Hazred almost 2 years
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.