ls

Linda haniganwork at earthlink.net
Wed Jan 27 01:50:19 UTC 2010


Werner Schram wrote:
> nepal wrote:
>   
>> On Tuesday 26 Jan 2010 21:03:53 Linda wrote:
>>   
>>     
>>> Is there a way to make ls silent if there is no match? I'm not
>>>  finding  it in the options, but am hoping I'm just reading over it
>>>  in the man page. Thanks
>>>           Linda
>>>
>>>     
>>>       
>> Hi Linda
>>
>> File a bug report!
>>
>> The correct response to *ls* for a non-existent target should be an 
>> empty list.
>>
>> nepal.
>>   
>>     
> 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 refering 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.
                            Thanks
                             Linda




More information about the ubuntu-users mailing list