BASH   74

gpstime

Guest on 29th April 2022 03:13:13 PM

  1. #!/bin/sh
  2. if test "$1" = -c ; then
  3. while true ; do
  4. sed -n </dev/rfcomm1 's/^\$GPGGA,\([0-9]*[0-9]\)\([0-9][0-9]\)\([0-9][0-9]\.[0-9]*\),.*$/\1:\2:\3/p;q'
  5. done
  6. else
  7. TZ=UTC date $(sed -n </dev/rfcomm1 's/^\$GPGGA,\([0-9]*[0-9]\)\([0-9][0-9]\)\([0-9][0-9]\.[0-9]*\),.*$/\1:\2:\3/p;q')
  8. hwclock --systohc --utc
  9. fi

Raw Paste


Login or Register to edit or fork this paste. It's free.