Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 Message-ID: <52010.12.22.157.254.1060992800.squirrel@mail3411.b0.com> Date: Fri, 15 Aug 2003 19:13:20 -0500 (CDT) Subject: Manipulating list-o-paths variables (base-files) From: "mike808" To: , , X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Reply-To: mike808 AT users DOT sourceforge DOT net MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I also saw some thread on cygwin-app about issues when mangling with the MANPATH, PATH, etc. variables. Here's what I've done to alleviate the problem of every script tacking on another copy of /usr/local/bin or whatever to PATH, but never checks to see if it is already there, and sometimes even if the path being added exists. So, I wrote some helper functions that will prepend or append a path to a variable. It will do the right thing when the variable is empty, and won't insert directories multiple times, and won't insert directories that don't exist. I usually have them in someplace like /etc/profile.functions and then just source it in. That way other scripts that play with paths can also use the functions. Perhaps they can be useful in base-files? The functions help to preserve the existing path, setup your own, and then go back and re-add all of the paths in the original path variable. This way, any "extras" get included, but you get to determine the ordering, and eliminate duplicates. I've also created similar functions to remove paths (in case there are multiple entries for the same directory that should be removed). See http://www.archlug.org/kwiki/index.cgi?DesktopProfileKwikis for the code. Just create the related functions for MANPATH, LD_LIBRARY_PATH, and any other list-of-directories type of variable, and you're done. I just haven't gotten around to writing a function factory for this, so that you can create these functions on-the-fly for any variable. Regards, Mike -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/