On 01/11/2016 08:56 AM, [email protected] wrote:
For example, if I have the files "foo", "foo1" and "foo bar" in my directory, a call to

ls foo*

yields only foo and foo1. However, a call to ls "foo "* yields "foo bar" (sans quotes) as expected.

That's strange, and it's not what I observe on Fedora 23 x86-64 with Bash 4.3.42(1)-release (x86_64-redhat-linux-gnu):

$ touch foo fool 'foo bar'
$ ls foo*
foo  foo bar  fool

Most likely this is a bug with your shell, or somewhere else in your operating system, and not in 'ls' itself. This is because '*' processing is done by the shell. You can verify this by running strace and looking at its first line of output. E.g.,:

$ strace ls foo*
execve("/usr/bin/ls", ["ls", "foo", "foo bar", "fool"], [/* 63 vars */]) = 0
...

This says that the kernel invoked "ls" with the arguments "foo" "foo bar", and "fool".



Reply via email to