From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15708 invoked by alias); 8 Aug 2017 20:52:07 -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: X-Seq: 22803 Received: (qmail 15613 invoked by uid 1010); 8 Aug 2017 20:52:07 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f51.google.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(209.85.214.51):SA:0(0.5/5.0):. Processed in 2.059838 secs); 08 Aug 2017 20:52:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM, SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: jahvascriptmaniac@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Z1FAWuxtvgdye+R87Rv8fBdvHraSf6JJT+vhhhq/kkQ=; b=c4NlqSVEDxj6PnjbsluoHh3caEF4gCNfy9tb3ryhX1Qjx2lLLJ5ur0LpmJVmZelMDJ cE4XX/QyoMB/Tax7mInzZy1PzLaftNjXPu1t7VVoXDr3nI3XKs9QEb5FzCNfZPMYmD3r pd8peCiREVYr0bKq9WjdtQ7k9jLYhpesKjnrrBE9dZY2BKn03MUJ9OicGKTboXsvy0m/ UQAIU16Jbew60Z1OCwFFq9TAQMPL/1V1aGsY4eu4pCmPyrDPlMRUX1c5ktQvGugbbL1J aWo41cPV5TaaZMq/KVRNXls2XNoTC4XwUAl6eRhreSqaqnvVeP8D/2NOk8hWDH0I3kjE o/bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Z1FAWuxtvgdye+R87Rv8fBdvHraSf6JJT+vhhhq/kkQ=; b=KA+h9oUh8FBOy6KCIkhGIJC0vcohufqfjai8h/T23CbLhKG1uzq/CBRtmKUA3KPcLr zs9h4h8MsP94QANoJaz/BRqIkMEf/35bJmTHxngT7Mz6UK3WQAHaQqBgWEKwrDybku4p Fk8cZ/q3c3Q0qeSeHfWX0LIi2DlNT4YOc8EZC0+3Lao74QFPFZz6OTrSfw651H829ayS aVQLmwZu4x9CNwD0f9TfL+mmwM/rQ5wCNGgeXRyvV+p7nMNpu6nAML1xwGsjlQLklWDk RFJ9AnqXE9VHEBhjAhtfaAd+W0iJHglaVgrpULNE41ccv3EjuJ+d9TQGmD+C1ediPaJW zr6w== X-Gm-Message-State: AIVw110USMkdphg/BlpBHdrwKC60jcJoD/smzKGCFH5QhqCf/WeIx7+e EjuO82WT2uTiIx22NiMLgirT5+GjcYZa X-Received: by 10.36.166.75 with SMTP id r11mr4454750iti.55.1502225521449; Tue, 08 Aug 2017 13:52:01 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <3d606eba-4475-8676-0fe5-f189062d5b65@eastlink.ca> References: <3d606eba-4475-8676-0fe5-f189062d5b65@eastlink.ca> From: =?UTF-8?Q?Dup=C3=A9ron_Georges?= Date: Tue, 8 Aug 2017 22:51:40 +0200 Message-ID: Subject: Re: some color fails in command. To: Ray Andrews Cc: Zsh Users Content-Type: multipart/alternative; boundary="f403045fae04941e9b0556442219" --f403045fae04941e9b0556442219 Content-Type: text/plain; charset="UTF-8" Sorry I went off-list by accident there. I'm putting back the list in CC. 2017-08-08 22:37 GMT+02:00 Ray Andrews : > > Right, the 'fg' stuff isn't native to echo. I've asked this before, but > how do I get a command to pick up any and all settings? Is it simply a > case of sourcing .zshrc? That sounds simplest and best. Mind, I find that > when I create a command file it is usually because I want a clean slate, so > .... Or I want it on the path and sourced scripts aren't searched for the > same way, or are they? Can it be done? > Sourcing ~/.zshrc seems like a big hammer for a small issue, a lot of people have huge ~/.zshrc configurations. If you want to simply add a small utility command to your own shell, write it as a function in a separate file, and source that small file from your ~/.zshrc. If you want to write a standalone command (e.g. that can be used by other people which may have a different config) then as you say, it's better to start with a blank slate, and load what you need. I bet most of the contents of ~/.zshrc will be related to the prompt, auto-completion and other interactive behaviour, so the amount of things that you have to load manually will likely be small. fg is simply an array containing the escape sequences for the various colours, and is indeed not specific to echo. Since it is a variable (well, an array) changing the PATH won't affect the presence or absence of fg. When you write autoload colors && colors, it has a similar effect to sourcing (not just running) a script which would populate the fg array and a few others. This probably doesn't matter, but is there some intuitive reason why $PATH > would be imported but $fg not? > PATH is normally explicitly exported with: export PATH or export PATH="/home/me/bin:$PATH" which explicitly tells the shell to make that variable available to child processes. I don't know a way to export an array (hopefully someone more knowledgeable here will chime in about that), only simple scalar variables. But relying on too much things being present in the environment is usually a bad thing, as it makes your script more fragile and less likely to work on different configurations. relying on PATH, HOME and similar universal env vars is okay, and so is the use of env vars as switches which alter the behaviour of your script (they effectively become part of the "normal" way of calling your script, if you document them properly), but relying on the environment to contain utilities does not seem like a good idea to me. Cheers, Georges --f403045fae04941e9b0556442219--