Skip to content

Instantly share code, notes, and snippets.

@viktorbenei
Created July 21, 2014 18:24
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 viktorbenei/137e04edd4442547488b to your computer and use it in GitHub Desktop.
Save viktorbenei/137e04edd4442547488b to your computer and use it in GitHub Desktop.
Example: Generate Unix timestamp in bash script on OS X
#!/bin/bash
function getCurrentUnixTimestamp {
printf %s $(date +%s)
}
echo " (i) Generating current timestamp..."
current_unix_timestamp=$(getCurrentUnixTimestamp)
echo " Timestamp: $current_unix_timestamp"
echo " (i) Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment