in reply to What does ">>" do? (And other stat questions)
As for the sprintf line, this session under the debugger shows you how the $mode value (coming from stat($file)[2]) might be converted:
DB<1> @c = stat "data.txt"; DB<2> x @c 0 1946693715 1 6473924464489865 2 33261 3 1 4 1001 5 513 6 0 7 64 8 1375303088 9 1375303088 10 1375303088 11 65536 12 1 DB<3> $mode = $c[2]; DB<4> printf "%04o", $mode ; 100755 DB<5> printf "%04o", $mode & 07777; 0755
BTW, my "data.txt" does indeed have the 0755 permissions:
$ ls -l data.txt -rwxr-xr-x 1 Laurent None 64 31 juil. 22:38 data.txt
In the Unix file permission system, "rwxr-xr-x" is the same as the 0755 octal value.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does ">>" do? (And other stat questions)
by three18ti (Monk) on Nov 01, 2013 at 00:39 UTC | |
by Laurent_R (Canon) on Nov 01, 2013 at 11:37 UTC | |
by Laurent_R (Canon) on Nov 01, 2013 at 12:07 UTC | |
by three18ti (Monk) on Nov 03, 2013 at 00:57 UTC | |
by Laurent_R (Canon) on Nov 03, 2013 at 09:45 UTC | |
by three18ti (Monk) on Nov 05, 2013 at 06:25 UTC | |
|