Bash date/time arithmetic
问题 I have a little Bash script which suspends the computer after a given number of minutes. However, I'd like to extend it to tell me what the time will be when it will be suspended, so I can get a rough idea of how long time I have left so to speak. #!/bin/sh let SECS=$1*60 echo "Sleeping for" $1 "minutes, which is" $SECS "seconds." sleep $SECS && pm-suspend The only argument to the script will be how many minutes from now the computer should be suspended. All I want to add to this script is