Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How do you decide whether to make something a function or a script?
- X-seq: zsh-users 23608
- From: TJ Luoma <luomat@xxxxxxxxx>
- To: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: How do you decide whether to make something a function or a script?
- Date: Sat, 8 Sep 2018 21:22:17 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=B6w7lsBdlrDAe+fIytHYMImeEJH1fg5YREIexJdsVho=; b=HYJcLwG1ebT/LMYvP1zo6FqVXGfhtRNFwtg7g2DQBzO1tgzyWAZGte1PO8VjRSER3k fNa+WV9QTnyke2K+/CebjKXw8CUMKKEai9Ha61RUs8o8TqwNdb0a29N+fe7k7qsCwnmB dXyPjO7JX6SpFEg4aNs2JGJvKTnnYCyB/P9YCoCiX8ro2h5tTWc08q7Uq6oLlRW7DIge oSqIk4zPfEbEL6fv3+eWlPmTZkYAqL1Gmi4PqdL2uY5f6BxFPcbyfbtJdZ8GQ5gifity VMUYBcoyF7d13xZLzHhS9yPEDfDojtDC4KJoX1kn+2ac4r4MtEvrD/zU+GY9ud3ikLUK Jfyw==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
I've been moving some of my more elaborate functions into their own files
and using the autoload feature to import them into other scripts.
But it's gotten me to wonder:
Why make any functions at all? Why not just make them all scripts? If they
are scripts in the $PATH then you can just call them by name and they work
in the login shell or in scripts. If they are functions, you have to
autoload them first.
So I've gotten to wonder… what makes you make something a function vs a
script?
TjL
--
TJ Luoma
TJ @ MacStories <http://www.macstories.net/author/tjluoma/>
Personal Website: luo.ma <http://luo.ma/> (aka RhymesWithDiploma.com
<http://rhymeswithdiploma.com/>)
Twitter: @tjluoma <http://twitter.com/tjluoma>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author