the code in question is a simple but a very handy tool which I use very often on my and other machines of our department. It prints PATH env variable contents line by line, showing '==' signs for repeating paths, and '??' for non-existent ones.

I use for Win32, Linux, SunOS machines quite often with conjuction of other tool, about which I also will tell.

Regards,
Vadim.

#!/usr/bin/perl my @dirs = split(($^O eq 'MSWin32'?';':':'), $ENV{PATH}); for (0..$#dirs) { if (-d $dirs[$_]) { print " "; } else { print "??"; } print (((-d $dirs[$_])?" ":"??"),(exists $_{$dirs[$_]}?"=":" "),(sp +rintf "%3d. ",$_+1)); $_{$dirs[$_]}++; print $dirs[$_],"\n"; }

Replies are listed 'Best First'.
Re: nice PATH printing
by jsprat (Curate) on Apr 25, 2002 at 21:04 UTC
    Thanks!

    Here's a patch for Win32 (or other case-insensitive file systems?) to catch duplicates w/ different case -
    add this as line 15 before the "print (((-d ..."

    $dirs[$_] = lc ($dirs[$_]) if $^O eq 'MSWin32';