#!/usr/local/bin/perl $a = <>; chomp( $a ); @p0{"-","r"} = ( 0, 400 ); @p1{"-","w"} = ( 0, 200 ); @p2{"-","x","s","S"} = ( 0, 100, 4100, 4000 ); @p3{"-","r"} = ( 0, 40 ); @p4{"-","w"} = ( 0, 20 ); @p5{"-","x","s","l"} = ( 0, 10, 2010, 2000 ); @p6{"-","r"} = ( 0, 4 ); @p7{"-","w"} = ( 0, 2 ); @p8{"-","x","t","T"} = ( 0, 1, 1001, 1000 ); @a = (\%p0,\%p1,\%p2,\%p3,\%p4,\%p5,\%p6,\%p7,\%p8); $perms = 0; $result = `ls -lLd $a | awk '{print \$1}' | cut -b2-10`; chomp( $result ); print "$result\n"; for ( $x = 0; $x <= 8; $x++ ) { $b = substr( $result, $x, 1 ); print "char -> $b position -> $x "; print "value -> $a[$x]{substr( $result, $x, 1 )}\n"; $perms = $perms + $a[$x]{substr( $result, $x, 1 )}; } print "perms -> $perms\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File permission converter
by chipmunk (Parson) on Feb 15, 2001 at 03:02 UTC | |
by Centaurus (Novice) on Feb 15, 2001 at 04:47 UTC | |
|
Re: File permission converter
by AgentM (Curate) on Feb 15, 2001 at 02:46 UTC | |
by JSchmitz (Canon) on Feb 15, 2001 at 02:48 UTC | |
|
Re: File permission converter
by merlyn (Sage) on Feb 15, 2001 at 04:52 UTC | |
|