public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] bash wizardry needed: PATH and MANPATH grow and grow and grow
@ 2006-05-21 22:56 Kevin O'Gorman
  2006-05-23 20:06 ` znx
  0 siblings, 1 reply; 8+ messages in thread
From: Kevin O'Gorman @ 2006-05-21 22:56 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 744 bytes --]

I have inherited some pretty gnarly dotfiles that I don't really want to
fool with too much,
but I'm also unhappy with what they do to my environment.  They keep adding
the
same things over and over to some of the variables.

Does anyone know a nice little idiom for de-duping a colon-list like PATH or
MANPATH?
It has to retain one copy of each duplicate, preserving the order of *first*
appearances.
I know how to avoid duplicates when I do the coding myself:
       case :$PATH: in
             *:mynewthing:*) ;;
             *) export PATH=$PATH:mynewthing
       esac

I'm just not sure how best to turn the colon-list into something I can
iterate over.

Obviously, I use bash.

++ kevin

-- 
Kevin O'Gorman, PhD

[-- Attachment #2: Type: text/html, Size: 1010 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-07-07 18:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-21 22:56 [gentoo-user] bash wizardry needed: PATH and MANPATH grow and grow and grow Kevin O'Gorman
2006-05-23 20:06 ` znx
2006-05-24 14:58   ` Kevin O'Gorman
2006-05-26  1:27     ` znx
2006-05-27  2:52       ` Kevin O'Gorman
2006-06-03 21:11         ` znx
2006-07-05 19:33           ` Boyd Stephen Smith Jr.
2006-07-07 18:31             ` Kevin O'Gorman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox