Is there an established order for the arguments 'ls'?

I am a student and, as part of my cursor, I must recode the command lsand reproduce its behavior in the best way.

On a Mac (El Capitan 10.11.6), using the iTerm 2 (zsh) terminal, I get:

user> ls . -R
ls: -R: No such file or directory

And on Arch (latest version), using the default text interface (bash), I get:

user> ls . -R
<current directory content>

Although I would prefer to trust Arch, is it right for ls to abandon its option after the directory is specified? And is there any documentation declaring the order of the arguments?

+4
source share
1 answer

See the POSIX Utility Syntax Guide , entry No. 9:

9:

.

, , POSIX, ls -R ., -R , . .

GNU ( Arch ), , , .

, -R , , , -- : ls -l -- -R -l -R , , -R ; POSIX № 10.

+10

Source: https://habr.com/ru/post/1682346/


All Articles