Posts

Showing posts with the label zsh

How to write a zsh alias that calls a subshell?

How to write a zsh alias that calls a subshell? I am trying to create a zsh alias which would do the equivalent of: zsh cat `which some_command` In bash that is not achievable with an alias so I had a function in my ~/.bashrc with the following content: ~/.bashrc function catw { cat `/usr/bin/which "${1}"` } I moved the function to ~/.zhrc without changes and it works, but while in bash it executes immediately with zsh I am getting a several seconds delay before the cat command actually runs. ~/.zhrc bash zsh cat Is there a way to have this as a more efficient zsh alias? If not then why does the function takes longer to execute? Can I change anything in the function to make it work as fast as in bash ? zsh bash I tried your function in my zsh and catw ldd was pretty much instantaneous. Do you get the same lag when you repeat the command multiple times? – that other guy Jul 1 at 4:44 ...