X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=ZQ8WHLmLdrHL/cGvrNDz4a8PsdQT6Y3+cMiDTn1zqj6OJDvczUEAe vn0jDQKMBemyUwfUAyQKH2EN4if8Cniq7uWkUyjpPdZ6jI2B8Mw3eEvGN44lMdYm LCBOyTnUXLmw8HT1T4Jaqgq8XgzbBPHNgjgEeg0QYpX+r8GtpM1rAA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=Hdqk9jWairldOEgJQIA0vtOXMVY=; b=Z6P/C6FMggbzwIDB9VBIuOfn/jIe ZxFcZrjD8lkNUG7TdcPFhxpFY6q3tQkZkP/TMJODmepJ8VXSO4DkjCXQB1IYA6cc gZuBUQcPuOqn09/Hecod6shwhDkIfHmMBJum0PcuActer3l1iYgmzwFJqWQDRDc3 yC+MLF1iz1I7y9s= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=X2HduIDJrUackVlNGRAt6BX0T17VIeoUmTwaXjQpAeQ=; b=m/meFn+Q430GeEhr0nS32qIFPDgF6U8WsNiaRFBIZtQJw/se4lDsf1NcaPhcmmS9pq +AQ3rsnBwIfo7y0JOLvvSKvPBnR3Uya19S95y5XO8CwNEPeEuo+4+Me4hIAFQ/v8zB4u LuqVtDqUpcQe2X2XK0mcaeBk12Dev7jn5OqcMMWDE//ApsItKDDfiOTW2XgN6H3E/V3J MNY3YCLorz6ZDZyuLoaoDjbWsFnR7dLB39g0vMlxo/zaLsxQBfqeQW9Qc1ZhSSD7rAna yUj/TdDH9n9bzc2hT88qXnWxUjOTqR9WdFRDGfGzFoQ6ECbtwwhRAIJsZMuj9ErJleON GnWw== X-Gm-Message-State: ALoCoQlTKQjxnsOCrRXgG3Zq76WSoysypEci0VRdq6E5SdgWCmSaeCYKADfolw6cKvw35W5SqHoA X-Received: by 10.194.58.177 with SMTP id s17mr6267748wjq.102.1444842843428; Wed, 14 Oct 2015 10:14:03 -0700 (PDT) Date: Wed, 14 Oct 2015 18:14:00 +0100 From: Adam Dinwoodie To: cygwin AT cygwin DOT com Subject: Re: [Attn: base-files maintainer] Changing /etc/profile to add more shell-dependent settings Message-ID: <20151014171400.GP14466@dinwoodie.org> Reply-To: cygwin AT cygwin DOT com References: <20151014155256 DOT GN14466 AT dinwoodie DOT org> <876129s86w DOT fsf AT Rainer DOT invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <876129s86w.fsf@Rainer.invalid> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On Wed, Oct 14, 2015 at 06:53:27PM +0200, Achim Gratz wrote: > Adam Dinwoodie writes: > > The /etc/defaults/etc/profile file in base-files has a section at the > > end to import scripts in /etc/profile.d, but this currently only works > > with zsh. > > No, this section is specific to zsh and probably even the wrong thing to > do -- /etc/profile is only ever intended to be run by POSIX compatible > shells (or shells in POSIX mode if they support that notion). I've kept > it alive for the time being since nothing packaged in Cygwin depends on > it. For anybody else using it for their personal customization it must > already be working. > > > Can this section be expanded to make calls as appropriate for other > > shells? I'm particularly interested in Fish and Bash, although I don't > > see any reason to limit the change to those shells. > > Bash can use ".sh" with the proviso that you can only use the POSIX > subset of its functionality. Other, non-POSIX, shells should implement > something similar in their own startup scripts. Csh already does, I > don't know enough about fish to tell how to insert something into its > start-up. IIRC, Zsh also has a way to run extra code besides just the > one in /etc/profile if you somehow need that. > > > I care about this because I'm currently investigating packaging fzf[0]. > > The obvious way to include the shell-specific keyboard shortcuts for fzf > > is to add them to /etc/profile.d, but currently that only works for > > Z-Shell. > > Look again, and don't let yourself get distracted by the zsh specific > code. :-) Mmmkay. So I'll find somewhere else to put the zsh and fish specific scripts (I've already found somewhere for fish, and I'll take your word that zsh also has a similar directory). That, however, doesn't give me anywhere to put the Bash fzf script. It's not POSIX compliant, so I don't want to use ".sh". I can't find any directory other than /etc/profile.d that Bash trawls, though. The only other option I can think of is to rename the .bash file to .sh and to patch it to check $BASH_VERSION before running the Bash-specific code. That seems fragile though -- it means putting Bashisms in a script that may be run by non-Bash shells (even if it's gated by checking $BASH_VERSION), and it means a patch of the upstream fzf Bash script in a way that's essentially just duplicating code already in /etc/profile. (The upstream solution to this is to add code to the user's ~/.bashrc to source the relevant scripts, but I don't think that's feasible when installing the scripts via setup-*.exe.) -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple