Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How do you decide whether to make something a function or a script?
- X-seq: zsh-users 23610
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Grant Taylor <gtaylor@xxxxxxxxxxxxxxxxxx>, zsh-users@xxxxxxx
- Subject: Re: How do you decide whether to make something a function or a script?
- Date: Sun, 09 Sep 2018 02:21:14 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Ke2wuV j9gj1ActI3jI2Uo8YkvebGGaLKlmLIIDKwVkQ=; b=hq2/BBjwENo5xbZpf0D7NQ wAvuO+vUzsd5SOSC5Lha+moZyOzrHnsmmdTaF91zYojj39KOvSAGJ/cqoPTxMZGn xFu5R+G5HmKiPZAGXi5YEJSPmu1DiEJtzBAKBaaP3iR4pf0XtpO9mrd14oHONBVR BqlNZLFZB1JtdjDPLuzUqABDAKqXV0LSO4u+leJQo5BZAnrLGoQ6juS/1BL6w0lz xRc0dLlmHn8qk39p1KW0O8r94NngzTGgIe7/r/GOqX2i7DpZ34ivqW3XqADSBkAN lJLBidxwqAOrQ1Dl94GnaU01LmeW8aAkM+x1aDBwuK39l0Y5T/4BTZ+w+JSKuK5w ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Ke2wuV j9gj1ActI3jI2Uo8YkvebGGaLKlmLIIDKwVkQ=; b=r77haE6P7WuV5uICstHGtk Rlj6tQFZH1olydv4RxoOWKBxTQlYJAnKYhE5kNwxUaKlPitSBVuN69UhvqFJGEYa bdN0YiEgn/JkHJ+GsimP1KV2VjBlVrU0NjhnVaTwqXRWEiETm0UpJWOi6A/+ed5k cbGJWpKGSaBZoNnXxNJogWYwLAk8n1fcqMjYIZIKGvcDGklXbXTqrUhE4ARZYY+k tb+100Okjn0FNAWA1fDKoZRwVYiH8bvdwtWOuAbqUOiZiqga0RKLjKnuuQ/M8ORB wgwuMJI34nuvZDOvs7JcZ04Z1m/l7S9PtgSUTpDCkrnoo8uuBPfzG5JxdPEFaW9Q ==
- In-reply-to: <c326defd-125c-823b-b281-a26b431e0727@spamtrap.tnetconsulting.net>
- 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
- References: <CADjGqHuK2oV3VzjHO0H5+FHJXC85HmysL9yPRjS-ESLhBcC3FA@mail.gmail.com> <c326defd-125c-823b-b281-a26b431e0727@spamtrap.tnetconsulting.net>
Grant Taylor wrote on Sat, 08 Sep 2018 19:55 -0600:
> I upgrade from functions to scripts when I want to be able to run the
> command from outside of the shell, like an ssh remote command: ssh
> myserver openDB. The remote command doesn't launch the shell, thus
> doesn't have access to functions, much less aliases. But it does have
> access to scripts if I have my PATH configured properly.
The remote command in 'ssh myserver foo bar' indeed doesn't have
access to functions or aliases, but it does go through a shell on the remote
end. It simply uses a non-interactive shell. That's why changes to PATH in
zshenv are honoured by ssh commands, and why functions aren't available
(zshrc isn't read).
Cheers,
Daniel
(I don't mean to nitpick; sometimes this distinction matters.)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author