Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created August 19, 2015 00:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/81985ffb4865085724c8 to your computer and use it in GitHub Desktop.
Save rtrouton/81985ffb4865085724c8 to your computer and use it in GitHub Desktop.
Figuring out if a home folder was created today or not.
#!/bin/bash
homefolder="$(mdls -raw -name kMDItemFSCreationDate $HOME | awk '{ print $1 }')"
if [[ "$homefolder" == $(date +"%Y-%m-%d") ]]; then
echo "Created today!"
fi
if [[ "$homefolder" != $(date +"%Y-%m-%d") ]]; then
echo "Not created today!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment