From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23610-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.1 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id ceb050bc for ; Sun, 9 Sep 2018 02:21:32 +0000 (UTC) Received: (qmail 20175 invoked by alias); 9 Sep 2018 02:21:20 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23610 Received: (qmail 22969 invoked by uid 1010); 9 Sep 2018 02:21:20 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.25):SA:0(-2.6/5.0):. Processed in 2.303468 secs); 09 Sep 2018 02:21:20 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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 == X-ME-Proxy: X-ME-Sender: Message-Id: <1536459674.3644536.1501585440.2BF2B86D@webmail.messagingengine.com> From: Daniel Shahaf To: Grant Taylor , zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-1234af23 References: In-Reply-To: Date: Sun, 09 Sep 2018 02:21:14 +0000 Subject: Re: How do you decide whether to make something a function or a script? 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.)