File: rmdotdot

package info (click to toggle)
mpqc 2.3.1-22
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 43,140 kB
  • sloc: cpp: 258,686; sh: 8,532; perl: 6,017; ansic: 5,499; makefile: 2,497; fortran: 1,970; lisp: 1,269; yacc: 313; lex: 177; csh: 45
file content (20 lines) | stat: -rwxr-xr-x 262 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
eval 'exec perl $0 $*'
    if 0;

$path = shift;
$newpath = rmdd($path);

while ($path ne $newpath) {
    $path = $newpath;
    $newpath = rmdd($path);
}

print $newpath;

sub rmdd {
    my $path = shift;
    $path =~ s/\/[^\/.]*\/\.\.//;
    return $path;
}