Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 64345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:46:31+00:00 2026-05-10T18:46:31+00:00

It is typical to have something like this in your cshrc file for setting

  • 0

It is typical to have something like this in your cshrc file for setting the path:

set path = ( . $otherpath $path ) 

but, the path gets duplicated when you source your cshrc file multiple times, how do you prevent the duplication?

EDIT: This is one unclean way of doing it:

set localpaths = ( . $otherpaths ) echo ${path} | egrep -i '$localpaths' >& /dev/null if ($status != 0) then     set path = ( . $otherpaths $path ) endif 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:46:31+00:00Added an answer on May 10, 2026 at 6:46 pm

    you can use the following Perl script to prune paths of duplicates.


    #!/usr/bin/perl # # ^^ ensure this is pointing to the correct location. # # Title:    SLimPath # Author:   David 'Shoe Lace' Pyke <eselle@users.sourceforge.net > #   :   Tim Nelson  # Purpose: To create a slim version of my envirnoment path so as to eliminate #       duplicate entries and ensure that the '.' path was last. # Date Created: April 1st 1999 # Revision History: #   01/04/99: initial tests.. didn't wok verywell at all #       : retreived path throught '$ENV' call #   07/04/99: After an email from Tim Nelson <wayland@ne.com.au> got it to #         work. #       : used 'push' to add to array #       : used 'join' to create a delimited string from a list/array. #   16/02/00: fixed cmd-line options to look/work better #   25/02/00: made verbosity level-oriented # #  use Getopt::Std;  sub printlevel;  $initial_str = ''; $debug_mode = ''; $delim_chr = ':'; $opt_v = 1;  getopts('v:hd:l:e:s:');  OPTS: {     $opt_h && do { print '\n$0 [-v level] [-d level] [-l delim] ( -e varname | -s strname | -h )'; print '\nWhere:'; print '\n   -h  This help'; print '\n   -d  Debug level'; print '\n   -l  Delimiter (between path vars)'; print '\n   -e  Specify environment variable (NB: don't include \$ sign)'; print '\n   -s  String (ie. $0 -s \$PATH:/looser/bin/)'; print '\n   -v  Verbosity (0 = quiet, 1 = normal, 2 = verbose)'; print '\n';         exit;     };     $opt_d && do {         printlevel 1, 'You selected debug level $opt_d\n';         $debug_mode = $opt_d;     };     $opt_l && do {         printlevel 1, 'You are going to delimit the string with \'$opt_l\'\n';         $delim_chr = $opt_l;     };     $opt_e && do {         if($opt_s) { die 'Cannot specify BOTH env var and string\n'; }         printlevel 1, 'Using Environment variable \'$opt_e\'\n';         $initial_str = $ENV{$opt_e};     };     $opt_s && do {         printlevel 1, 'Using String \'$opt_s\'\n';         $initial_str = $opt_s;     }; }  if( ($#ARGV != 1) and !$opt_e and !$opt_s){     die 'Nothing to work with -- try $0 -h\n'; }  $what = shift @ARGV; # Split path using the delimiter @dirs = split(/$delim_chr/, $initial_str);  $dest; @newpath = (); LOOP: foreach (@dirs){     # Ensure the directory exists and is a directory     if(! -e ) { printlevel 1, '$_ does not exist\n'; next; }     # If the directory is ., set $dot and go around again     if($_ eq '.') { $dot = 1; next; }  #   if ($_ ne `realpath $_`){ #           printlevel 2, '$_ becomes '.`realpath $_`.'\n'; #   }     undef $dest;     #$_=Stdlib::realpath($_,$dest);     # Check for duplicates and dot path     foreach $adir (@newpath) { if($_ eq $adir) {          printlevel 2, 'Duplicate: $_\n';         next LOOP;      }}      push @newpath, $_; }  # Join creates a string from a list/array delimited by the first expression print join($delim_chr, @newpath) . ($dot ? $delim_chr.'.\n' : '\n');  printlevel 1, 'Thank you for using $0\n'; exit;  sub printlevel {     my($level, $string) = @_;      if($opt_v >= $level) {         print STDERR $string;     } } 

    i hope thats useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've heard that it is a bad idea to do something like this. But
So basically I have something like this: private SortedDictionary<Priority, List<String>> example = new SortedDictionary<Priority,
So I have a function that looks something like this: float function(){ float x
Consider some typical CF code involving error handling, say something like this: ABRecordRef aRecord
I want to do typical highlight code. So I have something like: $valor =
I have a typical form_for for registering user. But in the end I would
I have a setup that looks like this. class Checker { // member data
I have a User Control for typical CRUD like actions on my WinForm app.
I have a dataset obtained from MySQL that goes like this: Array ( [0]
I want to write a rule that looks something like this: foo.out: (out of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.