Etaoin Shrdlu schrieb:
On Sunday 30 September 2007, Florian Philipp wrote:

Which shell do you use? Bash's default behavior (I don't know whether
you can change that) is that it doesn't expand * to all files and
directories but only the nonhidden.

Just try the following:
ls -l --directory --all ~/*

On my system it only shows my a long lost of all directories and files
without a dot at the beginning although, strictly speaking, the
command should show all files, even the hidden ones.

No, it should not (assuming the syntax of your example), unless bash "dotglob" option is on. One thing are the options to ls, another is how the shell expands wildcard characters. In your example, the tilde is expanded to the user's home dir (eg, /home/user), the asterisk is expanded to all the file and directory names under /home/user not starting with ".", so what ls really sees is

ls -l --directory --all /home/user/dir1 /home/user/dir2 /home/user/file1 /home/user/file2 etc.

Since you gave the "--directory" (aka "-d") option, and "*" expansion does not include names starting with ".", nothing else is printed. The "--all" option does not come into play at all here.

A different story would be if you did not use the -d option; then names at first level starting with "." still would not have been shown (because "*" is expanded by the shell before ls sees the names), but directory contents would have been listed including names starting with ".", due to the --all option.


That's exactly what I wanted to explain to Dale ;)

Sorry if I puzzled you.
--
[EMAIL PROTECTED] mailing list

Reply via email to