daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. declare -i Result_M
  3. declare -i Resilt_S
  4. declare -i Resilt_H
  5. start=`date | cut -d " " -f 6`
  6. start_H=`echo $start |cut -d ":" -f 1`
  7. start_M=`echo $start |cut -d ":" -f 2`
  8. start_S=`echo $start |cut -d ":" -f 3`
  9.  
  10. echo "Prease press the Enter Key if you want to stop."
  11. read PUSH_KEY
  12. #if [ "$PUSH_KEY" = "" ]; then
  13. #       echo "Stop"
  14. #fi
  15. End=`date |cut -d " " -f 6`
  16. End_H=`echo $End | cut -d ":" -f 1`
  17. End_M=`echo $End | cut -d ":" -f 2`
  18. End_S=`echo $End | cut -d ":" -f 3`
  19.  
  20. Result_H=$(($End_H - $start_H))
  21. Result_M=$(($End_M - $start_M))
  22. Result_S=$(($End_S - $start_S))
  23.  
  24. if [ $Result_S -lt 0 ]; then
  25.         Result_H=`expr 24 + $Result_S`
  26. fi
  27. if [ $Result_M -lt 0 ]; then
  28.         Result_M=$((60 + $Result_M))
  29.         Result_H=`expr Result_H - 1`
  30. fi
  31. if [ $Result_S -lt 0 ]; then
  32.         Result_S=`expr 60 + $Result_S`
  33.         Result_M=`expr $Result_M - 1`
  34. fi
  35. echo "$Result_H 時間 $Result_M 分 $Result_S 秒"
  36. exit 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top