rest(){
echo "have a rest in "$1 " minutes"
at -f /home/rest.sh now+$1 minutes
}
To edit a rest.sh script.
vim /home/rest.sh
xscreensaver-command --lock
To test it.
rest 60
have a rest in 60 minutes
warning: commands will be executed using /bin/sh
job 7 at Thu Feb 9 11:15:00 2017
Can the at
command in rest be simplifed?
To delete the /home/rest.sh, to pass parameter with pipe or other way?
at and batch read commands from standard input or a specified file which are to be executed at a later time, using /bin/sh.
man at
So, you can feed it commands with a HEREDOC, like this:
rest(){
echo "have a rest in "$1 " minutes"
at now+$1 minutes <<EOF
xscreensaver-command --lock
EOF
}
(note that the limit string EOF
can not have any whitespace in front of it)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With