Normally these would go in one's .bashrc file to be used as a stopwatch, but they are sort of inconvienent to use and recall with the several different commands for the different units of time.
function time_seconds()
{
echo "Counting to $1 seconds"
time_func $1
}
function time_minutes()
{
echo "Counting to $1 minutes"
time_func $1*60
}
function time_hours()
{
echo "Counting to $1 hours"
time_func $1*60*60
}
function time_flexible() # accepts flexible input hh:mm:ss (does not work)
{
echo "Counting to $1"
secs=$(time2seconds $1)
time_func $secs
}
I would like to convert all these functions, commands into one function, one command. I think a lot of people would find this almost as useful as the sleep command... well, not quite... but still very convenient to have. Speaking of the sleep command, it works as follows, example:
sleep 5h 22m 44s
I would like to turn these commands into a one stopwatch command in which accepts a input values exactly like the sleep command, example:
stopwatch 5h 22m 44s
How would I go about accomplishing this?
p.s. feel free to modify the stopwatch display output if you see your changes making this more universally accepted as simpler and easier.