Track your tasks working time, using a bash script

#!/bin/bash
# filename: tracking.sh

mkdir -p tracking
action=$1
project=$2
timeNow=`date "+%Y.%m.%d %H:%M:%S"`
dateNow=`date "+%Y-%m-%d"`

# Create the daily file
touch "./tracking/$dateNow.txt"

if [ "$action" == "start" ]
then
    echo "Started to work on : $project" >> "./tracking/$dateNow.txt"
    echo "$timeNow" >> "./tracking/$dateNow.txt"
else
    echo "$timeNow" >> "./tracking/$dateNow.txt"
    echo " " >> "./tracking/$dateNow.txt"
    echo " " >> "./tracking/$dateNow.txt"
fi

 

How to use :

# make your file executable
chmod +x tracking.sh

# use the following command to execute it
./tracking.sh start Project Name
./tracking.sh end

 

Top