Hi,
The solution proposed by
VSarkiss is interesying, but
it has two drawbacks. First, it only applies to bash or sh, and second, does not generalize to other PATH like variables. I think this one solves these problems.
-
Put the following in your .profile if you are
using sh or bash:
PATH =`munch.pl $PATH`
This is replaced by:
setenv PATH `munch.pl $PATH`
to put in .cshrc if you are using csh or tcsh.
-
The munch.pl script (why, VSarkiss, I like that name:)) is something like this:
#!/usr/bin/perl -w
use strict;
my @comp = split /:/,shift;
my %saw = ();
@saw{@comp} = ();
print join ":",keys %saw;
This gives the following under bash:
$ TEST="a:b:c:a:c:z:a:b:z"
$ echo $TEST
a:b:c:a:c:z:a:b:z
$ TEST=`tmp/test.pl $TEST`
$ echo $TEST
a:z:b:c
and the following under csh:
> setenv TEST "a:b:c:a:c:z:a:b:z"
> echo $TEST
a:b:c:a:c:z:a:b:z
> setenv TEST `tmp/test.pl $TEST`
> echo $TEST
a:z:b:c
Hope that helps....
Cheers
Leo TheHobbit
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.