public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Kevin O'Gorman" <kogorman@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: [gentoo-user] bash wizardry needed: PATH and MANPATH grow and grow and grow
Date: Sun, 21 May 2006 15:56:38 -0700	[thread overview]
Message-ID: <9acccfe50605211556h542921a9kbd79da6a016e2101@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2006-05-21 23:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-21 22:56 Kevin O'Gorman [this message]
2006-05-23 20:06 ` [gentoo-user] bash wizardry needed: PATH and MANPATH grow and grow and grow 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9acccfe50605211556h542921a9kbd79da6a016e2101@mail.gmail.com \
    --to=kogorman@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox