dotfiles

<-- duh.
git clone https://hhvn.uk/dotfiles
git clone git://hhvn.uk/dotfiles
Log | Files | Refs | Submodules | LICENSE

cst2secs (244B)


      1 #!/bin/sh
      2 #
      3 # colon-seperated-time to seconds
      4 
      5 [ -z $1 ] || [ "$1" = "-h" ] && echo "usage: cst2secs [HH:]MM:SS" && exit 1
      6 
      7 echo "$1" | awk -F":" -v "s=0" '{
      8 		n=1
      9 		for (i=NF; i != 0; i--) {
     10 			s = s + ($i * n)
     11 			n = n * 60
     12 		}
     13 		print s
     14 	}'