Skip to content

Instantly share code, notes, and snippets.

@thombashi
Created January 22, 2017 05:27
Show Gist options
  • Save thombashi/2b8a2c49f8eaf03bb97433cfaa9c5715 to your computer and use it in GitHub Desktop.
Save thombashi/2b8a2c49f8eaf03bb97433cfaa9c5715 to your computer and use it in GitHub Desktop.
date command with RFC-2822/RFC-3399 format
#!/bin/bash
function date_wrapper() {
command="date --rfc-3339=$1"
echo "$ ${command}"
echo -e "`${command}`\n"
}
echo -e "--- date command output with RFC 2822 format ---"
command="date --rfc-2822"
echo "$ ${command}"
echo -e "`${command}`\n"
echo -e "--- date command output with RFC 3399 format ---"
for format in date seconds ns
do
date_wrapper ${format}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment