Author Login
Post Reply
On 25-Apr-08, at 10:19 AM, Bill Watson wrote:
> Ok, maybe I missed a memo 5-10 years ago, but why does
> # ls [A-Z]*
> And
> # ls | grep [A-Z]
> give different results (the filenames are either upper or lower case
> - not
> mixed in the example).
>
> Why does [A-Z] mean AbBcCdD in ls while it means ABCD in grep?
One is bash path globbing, as defined in the bash manpage. The other
is a proper regular expression, as defined in the regex manpage.
Generally, most applications follow the regex convention, but file
operations follow bash globbing in bash - "*", for example, means all
files, ".*" would be all files beginning with ".", while in regular
expressions, these have different functions (".*" is 0 or more
instances of any character).
--
Ken Snider
_______________________________________________
rhelv5-list mailing list
rhelv5-list@(protected)
https://www.redhat.com/mailman/listinfo/rhelv5-list