问题
I just want to echo my string after 1 hour. I saw at command but it can run script at specific time (HH:MM). I want my echo command to run after 1 hour whatever the time it is.
回答1:
It is sleep 60m && ls
回答2:
You can also use at (at is very good at understanding times, see this page for a lot of good examples).
> at now + 1 hour
at> echo 'my string' > /dev/stdout
at> ^D
After you input the at time specification it will take you to the at prompt (your OS my or my not show the at> prompt, OSX doesn't for example). You then type whatever commands you want executed and press Control-D to exit the at prompt. One caveat: at will run your commands and mail you the result. So if you want your output to appear on your terminal, you should direct your output to the appropriate device: /dev/stdout and /dev/tty usually work.
来源:https://stackoverflow.com/questions/33901726/run-command-after-1-hour-in-linux