Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Having written a large number of CLIs in the past, I've often come across this issue but never had a good solution. This is remarkably simple, elegant, and easily generalized into a CLI framework so it can be implemented with ease. Thank you for sharing this nugget of gold!


Sadly Zsh uses ! for history expansion so they'd all have to be escaped in that shell.


Even in the middle of a line, not just at the start?


Yes, and it's a great feature IMO:

    touch projects/new-lib/readme
    cd !!:1:h




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: