ls

Amedee Van Gasse (ub) amedee-ubuntu at amedee.be
Wed Jan 27 01:56:20 UTC 2010


On Wed, January 27, 2010 02:50, Linda wrote:
> Werner Schram wrote:

>> ls does print an error message if you provide a filter which doesn't
>> yield a result (ls: cannot access ...: no such file or directory). I
>> think she is refering to that. But because the error message is sent to
>> the standard error output, you can dispose of it by using:
>>
>> ls [non-existing filename] 2>/dev/null
>>
>> Werner
>>
>>
> The cannot access is the message I was referring to. I was using an ls
> system call inside of a program.
> ls -1 partial-filename*
> it dumps the results into a file and gives the user a list to choose
> from.  I just was hoping for a flag to silence the error message but I
> can redirect standard error instead.

Yes.
Linux has built-in separation between normal output and error output, so
programs don't have to provide special flags. The user only has to use the
built-in output redirection. That will work for all programs and the
programmers don't need to define extra flags.

Isn't Linux great? :-)

-- 
Amedee





More information about the ubuntu-users mailing list