[cs631apue] Overrides an option

Jan Schaumann jschauma at stevens.edu
Fri Sep 30 20:50:46 EDT 2016


mseaton <mseaton at stevens.edu> wrote:

> Does anyone understand the meaning of an option that overrides another? 
> For example, the -h option overrides the -k option.

That means that if both options are given, then the last option will
take precedence.  That is:

ls -h -k -h -k -k -k -k -h -k -h

is functionality equivalent to

ls -h

> "If more than one operand is given, non-directory operands are displayed 
> first;" Does this mean that any of the options listed in the man page 
> must appear before a directory name?

If you invoke

ls dir1 dir2 file1 file2 dir3

then the command will first display the informatino about file1 and
file2, followed by the contents of dir1, then dir2, then dir3.

> "directory and non-directory operands are sorted separately and in 
> lexicographical order." Not sure of the meaning of this statement.

If you invoke

ls zdir1 adir2 zfile1 afile2 kfile3 kdir3

then the command will isplay them in lexicographical order, files first,
then directories: afile2 kfile3 zfile1 adir2 kdir3 zdir1

-Jan


More information about the cs631apue mailing list