Skip to main content
ertius.org

shell alias evaluation

Recently I made two trivial shell aliases to make creating posts with Hugo a bit quicker. Despite being one line each, they were buggy! I had forgotten the pretty obvious fact that $(date ...) in a shell aliases would be evaluated, once, when ~/.zshrc was evaluated, ie at shell creation/login time.

To actually evaluate at invokation time, you need a shell function:

tom_til() {
    cd ~/src/til && hugo new til/posts/$(date -v +1d +%F).md
}