summaryrefslogtreecommitdiff
path: root/src/timestamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/timestamp')
-rwxr-xr-xsrc/timestamp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/timestamp b/src/timestamp
new file mode 100755
index 0000000..d8870e2
--- /dev/null
+++ b/src/timestamp
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ timestamp [-E]
+ EOF
+}
+
+EXTENDED=false
+while getopts 'E' flag; do
+ case "$flag" in
+ (E)
+ EXTENDED=true
+ ;;
+ (*)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
+if [ "$EXTENDED" = true ]; then
+ date '+%Y-%m-%dT%H:%M:%S%:z'
+else
+ date '+%Y-%m-%d'
+fi