I want to convert the output of ls to octal permission bits.
I think of the shortest and clearest way to implement that excerise: Let's say that we have as input:
total 1
drwxr----x 1 user2 workers 1024 May 26 22:22 dir
-rwx-wxrw- 2 user2 workers 1024 May 26 22:22 file.txt
our output should be:
741 dir
736 file.txt