Last active
March 23, 2017 14:00
-
-
Save stigok/42a045f1ad77eadfbb6d to your computer and use it in GitHub Desktop.
Get current system time as hex string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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