[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does grep [^0-9] become grep u?
From: |
David Liontooth |
Subject: |
Re: Why does grep [^0-9] become grep u? |
Date: |
Fri, 23 Feb 2007 11:17:45 -0800 |
User-agent: |
Icedove 1.5.0.9 (X11/20061220) |
Matthew Woehlke wrote:
> David Liontooth wrote:
>> In two windows of the same KDE konsole, I get this:
>>
>> $ echo aa | strace grep [^0-9]
>> execve("/bin/grep", ["grep", "u"], [/* 31 vars */]) = 0
>> [snip]
>
> (expanding on Andreas' answer...)
> [^0-9] is being interpreted by your shell (probably bash) as a
> globbing sequence that matches any files whose name is a single
> character that is not a digit. If there are no matches, the glob is
> passed unaltered, otherwise it is expanded. You probably meant to
> write "grep '[^0-9]'" (note the single quotes!) to prevent shell
> expansion. It is ALWAYS good practice to properly quote arguments.
>
Fantastic -- really appreciate.
Dave