If you want to see all 4096 possible file permissions, the following code will generate each of them in the directory of your choice (named '0nnnn_xxxxxxxxx.txt', where '0nnnn' is the octal permission, and 'xxxxxxxxx' is the string form of the permissions). (Each file contains only the text of its file name, including the provided path.)
Code:
Example of created files:
$ ./working --create_dir --target_dir my_foo
$ cd my_foo && ls -labhrt | tail -n 1000 | head -n 10
---S-ws--x 1 User Group 27 Feb 17 23:29 06031_--S-ws--x.txt
---S-ws-w- 1 User Group 27 Feb 17 23:29 06032_--S-ws-w-.txt
---S-ws-wx 1 User Group 27 Feb 17 23:29 06033_--S-ws-wx.txt
---S-wsr-- 1 User Group 27 Feb 17 23:29 06034_--S-wsr--.txt
---S-wsr-x 1 User Group 27 Feb 17 23:29 06035_--S-wsr-x.txt
---S-wsrw- 1 User Group 27 Feb 17 23:29 06036_--S-wsrw-.txt
---S-wsrwx 1 User Group 27 Feb 17 23:29 06037_--S-wsrwx.txt
---Sr-S--- 1 User Group 27 Feb 17 23:29 06040_--Sr-S---.txt
---Sr-S--x 1 User Group 27 Feb 17 23:29 06041_--Sr-S--x.txt
---Sr-S-w- 1 User Group 27 Feb 17 23:29 06042_--Sr-S-w-.txt
Example of --debug output (d3106 = 06042):
$ ./working --create_dir --target_dir my_foo --debug
# ---skip---
%perm = (
"octal" => {
"0_special" => 3072,
"1_user" => 0,
"2_group" => 32,
"3_other" => 2
},
"octal_value" => {
"0_special" => 6,
"1_user" => 0,
"2_group" => 4,
"3_other" => 2
},
"raw_octal" => 3106,
"str" => {
"1_user" => "--S",
"2_group" => "r-S",
"3_other" => "-w-"
}
);
# ---skip---
|