Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Function or Alias - Does it matter?
- X-seq: zsh-users 19408
- From: James Pearson <pearson@xxxxxxxxxxxxxx>
- To: TJ Luoma <luomat@xxxxxxxxx>
- Subject: Re: Function or Alias - Does it matter?
- Date: Tue, 18 Nov 2014 16:45:35 -0800
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=LfW0gV3imRlfmwcogLTmWPIXnZU0exwyWd1wVdRuyHU=; b=TE2UlhQXjZTTM5Jek6tsG9jbAtEQ7kdLdrH2OK3iV+/kKi+c8AH6dfSwikbtuJmFkJ G4deHAulNMXRtQi5PeHaUxZAxt/er6y1bXFiWt7GlHdHOkYsB0lBkX3LqrjnmhE1FFfI Xxbxk1HG7YjUnJ7RvlwNAJvHnkdNIDr5R22FtpwgVnyr+ah9WhvJF+LYuDR9LE2G7Ebi YuvJKroBSkp/g4Tu1aRHraFVpkxAiIGxuw7uPzUFpH/J7fqal4nxqvcjHiVIcCf0pi+Q bM1Xl1t8B5M1Oz8lpbnKv+iaZQ/gNr6CaNKrTzL6z6ada3dfmEbLQ5y5v16U7HIEIyXu swiA==
- In-reply-to: <CADjGqHuZpMyRCvEMivTZhW63Dk0wgSR8K+q0Whd_MhW57qB0Ag@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CADjGqHuZpMyRCvEMivTZhW63Dk0wgSR8K+q0Whd_MhW57qB0Ag@mail.gmail.com>
- Sender: xiong.chiamiov@xxxxxxxxx
Functions can take arguments, which makes them more powerful for future
expansion. I forget if functions and aliases are treated the same by which
(as I recall zsh expands both of them).
On Nov 18, 2014 4:15 PM, "TJ Luoma" <luomat@xxxxxxxxx> wrote:
> Is there any practical difference between making an alias or a
> function if they do the same thing?
>
> For example, these are (as far as I know) functionally identical:
>
> function timestamp_r { strftime "%Y/%m/%d at %-I:%M:%S %p"
> "$EPOCHSECONDS" }
>
> alias timestamp_r='strftime "%Y/%m/%d at %-I:%M:%S %p"
> "$EPOCHSECONDS"'
>
> Is there any reason to prefer one or the other?
>
> Tj
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author