Last active
October 20, 2024 04:43
Revisions
-
tir38 revised this gist
Jun 26, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ # script to create timer in terminal # Jason Atwood # 2013/6/22 #!/bin/sh # start up echo "starting timer script ..." sleep 1 # seconds # get input from user -
tir38 renamed this gist
Jun 26, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
tir38 revised this gist
Jun 26, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # script to create stopwatch in terminal # Jason Atwood # 2013/6/22 #!/bin/sh @@ -8,7 +8,7 @@ echo "starting stopwatch script ..." sleep 1 # seconds # get input from user read -p "Timer for how many minutes?" -e DURATION DURATION=$(( $DURATION*60 )) # convert minutes to seconds # get start time -
tir38 created this gist
Jun 25, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ # script to create stop watch in terminal # Jason Atwood # 2013/6/22 #!/bin/sh # start up echo "starting stopwatch script ..." sleep 1 # seconds # get input from user read -p "Stopwatch for how many minutes?" -e DURATION DURATION=$(( $DURATION*60 )) # convert minutes to seconds # get start time START=$(date +%s) # infinite loop while [ -1 ]; do clear # clear window # do math NOW=$(date +%s) # get time now in seconds DIF=$(( $NOW-$START )) # compute diff in seconds ELAPSE=$(( $DURATION-$DIF )) # compute elapsed time in seconds MINS=$(( $ELAPSE/60 )) # convert to minutes... (dumps remainder from division) SECS=$(( $ELAPSE - ($MINS*60) )) # ... and seconds # conditional if [ $MINS == 0 ] && [ $SECS == 0 ] # if mins = 0 and secs = 0 (i.e. if time expired) then # blink screen for i in `seq 1 180`; # for i = 1:180 (i.e. 180 seconds) do clear # flash on setterm -term linux -back red -fore white # use setterm to change background color echo "00:00 " # extra tabs for visibiltiy sleep 0.5 clear # flash off setterm -term linux -default # clear setterm changes from above echo "00:00" # (i.e. go back to white text on black background) sleep 0.5 done # end for loop break # end script else # else, time is not expired echo "$MINS:$SECS" # display time sleep 1 # sleep 1 second fi # end if done # end while loop