Skip to content

Instantly share code, notes, and snippets.

@kevwil
Created February 7, 2012 23:39
Show Gist options
  • Save kevwil/1763010 to your computer and use it in GitHub Desktop.
Save kevwil/1763010 to your computer and use it in GitHub Desktop.
memoize a backticked system call result in zsh
my_date(){
readonly d="`date`" || echo "$d"
echo "$d"
}
# should always be the same result
print $(my_date)
sleep 2
print $(my_date)
sleep 2
print $(my_date)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment