On 06/25/2018 05:08 PM, Michael Rasmussen wrote: > On 2018-06-25 16:18, Steve Christiansen wrote: >> On 6/25/2018 3:52 PM, Rich Shepard wrote: >> >>> According to 'man ls' the -d option should 'list directories >>> themselves, not their >>> contents'. But, here it doesn't work. For example from within ~/: >>> >>> $ ls -d >>> ./ >>> >>> $ ls --directory >>> ./ >>> >>> I doubt this is a Slackware issue and I'm curious why it might not be >>> working as expected. Has anyone else run into this issue? >>> >>> Rich >>> _______________________________________________ >>> PLUG mailing list >>> [email protected] >>> http://lists.pdxlinux.org/mailman/listinfo/plug >>> >> >> Rich, >> It's working as expected. >> "ls" with no arguments lists the contents of the current directory. >> "ls -d" with no other arguments lists the current directory, not its >> contents, which is of course "." > > To expand that on that correct response, > > try ls -d */ > > for an edited example: > michael$ ls -d */ > Documents > Downloads > Finance > Pictures > ... > > >
Rich, Indeed, another unfortunate example of bad documentation grammar. programmers are historically poor at this. "list directories themselves, not their contents" talks about the directory you are in, not the directories _below_ the one you are in (i.e. contents). So I would write the description as "list the current directory, not its contents" "ls -l" assumes "ls -l ." so "ls -d" assumes ls -d ." ls [OPTION]... [FILE]... the [FILE] is not really optional! We tend to forget about "." and ".." As per Michael above, if you what the directory "contents" of where you are: ls -d * # assumes "./*" ls -d */ # assumes "./*" ls -d $PWD # expanded "." ls -d $PWD/* 0r ls -d <path-to-directory>/* -Ed
signature.asc
Description: OpenPGP digital signature
_______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
