Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: alias with a parameter



On 4/5/21 4:55 PM, dukeofpurl@xxxxxxx wrote:
I'm trying to set up the following alias (function actually): em() { emacs $1 -geometry "56x23" } such that I can pass a to `em' and bingo-bango I'm off programming some C code.

I use functions like that all the time.

Perhaps it's in the way that it's set up. Are you adding this to your ~/.zshrc file, or manually defining the function?

I've got the following in my ~/.zshrc file and it works perfectly.

   pd() {
      [ -n "${1}" ] && pushd "${1}" || popd;
   }

It's using parameters on a function, just like you're trying to do. It works a treat.

Aside: Yes, I'm lazy and don't want to type pushd or popd. Instead, the pd function determines which command to run based on if $1 is set or not.



--
Grant. . . .
unix || die

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



Messages sorted by: Reverse Date, Date, Thread, Author