为什么ls在交换选项-l和的顺序后表现不同-f?
$ ls -l -f
0821131236.jpg 0823130821.jpg
$ ls -f -l
total 33176
-rw-rw-r-- 1 t t 364186 Jan 6 16:06 0821131236.jpg
-rw-rw-r-- 1 t t 170003 Jan 6 16:06 0823130821.jpg
Run Code Online (Sandbox Code Playgroud)
在运行ls或其他具有多个选项的实用程序/命令时,我应该遵循什么建议?
这是记录在案的行为。
来自info ls:
-f:
Run Code Online (Sandbox Code Playgroud)Primarily, like `-U'--do not sort; list the files in whatever order they are stored in the directory. But also enable `-a' (list all files) and disable `-l', `--color', and `-s' (if they were specified before the `-f').
你应该使用什么完全取决于你需要什么。
在典型的软件中,参数通常是按顺序处理的,所以如果它们发生冲突,后一个选项会覆盖前一个,但仍然可以一起使用。但这只是一般的经验法则。您必须检查您打算使用的特定软件的文档并亲自试用。