X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Achim Gratz Subject: /etc/profile Date: Tue, 21 Aug 2012 10:16:28 +0000 (UTC) Lines: 71 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes 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 I'm removing the Windows PATH in my startup scripts since there's nothing in there that I think should be accessible from Cygwin. For (t)csh this is easy enough to do with dropping a script into /etc/profile.d that gets executed first, but there's no such provision for sh and the ilk since PATH is set up already before it get there. Now, unless profile gets changed I can still cut off "/usr/local/bin:/usr/bin:" with a profile.d script, but I think it might be preferrable that the Windows path gets recorded into ORIGINAL_PATH or some similar name at the beginning of profile. It would then be a simple matter to later add the Windows path where appropriate, but I don't think the default path should have it at all. Also, there are two things in profile that may admit slight improvement (a place where LC_COLLATE is specified just for one command and better guarding against a missing or non-cdable /etc/skel). Patch: --- /etc/defaults/etc/profile 2012-02-27 22:03:33.000000000 +0100 +++ /etc/profile 2012-08-21 12:12:42.617969800 +0200 @@ -29,7 +29,8 @@ # software to override 'system' software. # Modifying these default path settings can be done in different ways. # To learn more about startup files, refer to your shell's man page. -PATH="/usr/local/bin:/usr/bin:${PATH}" +ORIGINAL_PATH=$PATH +PATH="/usr/local/bin:/usr/bin" MANPATH="/usr/local/man:/usr/share/man:/usr/man:${MANPATH}" INFOPATH="/usr/local/info:/usr/share/info:/usr/info:${INFOPATH}" @@ -75,14 +76,17 @@ echo echo "They will never be overwritten nor automatically updated." echo - cd /etc/skel || echo "WARNING: Failed attempt to cd into /etc/skel!" - /usr/bin/find . -type f | while read f; do - fDest=${f#.} - if [ ! -e "${HOME}${fDest}" -a ! -L "${HOME}${fDest}" ]; then - /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}" - fi - done - unset fDest + if ! cd /etc/skel ; then + echo "WARNING: Failed attempt to cd into /etc/skel!" + else + /usr/bin/find . -type f | while read f; do + fDest=${f#.} + if [ ! -e "${HOME}${fDest}" -a ! -L "${HOME}${fDest}" ]; then + /usr/bin/install -D -p -v "${f}" "${HOME}/${fDest}" + fi + done + unset fDest + fi else echo "${HOME} could not be created." { [ -d "${TEMP}" ] && HOME="${TEMP}"; } || @@ -103,7 +107,7 @@ # Shell dependent settings profile_d () { - for file in $(export LC_COLLATE=C; echo /etc/profile.d/*.$1); do + for file in $(LC_COLLATE=C echo /etc/profile.d/*.$1); do [ -e "${file}" ] && . "${file}" done unset file Regards, Achim. -- 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