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

Re: Function or Alias - Does it matter?



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