Skip to content

Instantly share code, notes, and snippets.

@stigok
Last active March 23, 2017 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stigok/42a045f1ad77eadfbb6d to your computer and use it in GitHub Desktop.
Save stigok/42a045f1ad77eadfbb6d to your computer and use it in GitHub Desktop.
Get current system time as hex string
#!/bin/bash
# Get zero-padded hex string from date format
# Usage: f <format>
function f {
printf %02X $(date +$1)
}
h=$(f %-H)
m=$(f %-M)
s=$(f %-S)
echo $h:$m:$s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment