Skip to content

Instantly share code, notes, and snippets.

@dirkjanfaber
Created December 4, 2015 13:30
Show Gist options
  • Save dirkjanfaber/bff07bc5111a6fc2d222 to your computer and use it in GitHub Desktop.
Save dirkjanfaber/bff07bc5111a6fc2d222 to your computer and use it in GitHub Desktop.
Script for wrapping at in a function. This fixes the garbled time in most cases.
function at {
unset IFS
MOMENT=$*
AT=$(which at)
# First try at to see if I finally figured out to produce non-garbled time
if ${AT} ${MOMENT} 2>/dev/null
then
# worked allright, we can exit
exit
else
# We produced garbled time (duh), so let's fix this with date
MOMENT=$(date --date "${MOMENT}" +'%Y%m%d%H%M')
fi
# and try again
${AT} -t ${MOMENT}
}
@dirkjanfaber
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment