-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwt
More file actions
executable file
·21 lines (21 loc) · 756 Bytes
/
wt
File metadata and controls
executable file
·21 lines (21 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Worktimer.
if [ ! -f $HOME/.timehelper.txt ]; then
echo "Hidden file timehelper.txt was not found!"
echo "Making file now..."
echo $PS1 > $HOME/.timehelper.txt # Old PS1 value
echo "$(date +%s)" >> $HOME/.timehelper.txt # Starting time
PS1="[ON THE CLOCK]$ "
else
echo "Hidden file ista_timehelper.txt found!"
echo "Deleting file, reseting PS1 shell variable, and calculating time now..."
oldPS1="$(head -1 $HOME/.timehelper.txt)"
startTime="$(tail -1 $HOME/.timehelper.txt)"
endTime="$(date +%s)"
echo "oldPS1: $oldPS1"
echo "startTime: $startTime"
echo "endTime: $endTime"
echo "total time: $(( (endTime - startTime) / 60)) minutes."
PS1=$oldPS1" "
rm $HOME/.timehelper.txt
fi