Oh! bash is confusing (was Re: [Ilugc] bash escape - use quotes)

  • From: praveen@xxxxxxxxxxx (Praveen Kumar)
  • Date: Mon, 16 Feb 2004 20:33:35 +0530

Sridhar R wrote:


Try these

$ touch a??b
$ rm a??b  # works


Try also these

$ touch a??b
$ touch a22b
$ ls
a??b a22b
$ rm a??b
$ ls
(Both the files will be missing)


$ touch ??
$ rm ??    # works!! ;>-


$ touch ??
$ touch aa
$ ls
?? aa
$ rm ??
(Both the files will be missing)

$ touch ^V^G^V^G
$ rm ??    # works! sigh!

(Suraj! note the above.  I said about a file '??'.  I
was unable to remove it using 
$ rm ??

But now, for `touch ^V^G^V^G` it works.  Bash is very
confusing!


$ touch ^V^G^V^G
$ ls
^V^G^V^G
$ rm ??
rm: cannot remove `??': No such file or directory
$ rm ????
rm: cannot remove `????': No such file or directory
$ rm ^V^G^V^G
$ ls
(File deleted)

I don't see any confusing behavior. It's doing what it should!

Regards,
Praveen.

-- 
+----------------------------------------+--------------+
| Praveen Kumar                          |    .''`.     |
| praveen AT symonds DOT net             |   : :'  :    |
| praveen AT users DOT sarovar DOT org   |   `. `'`     |
| Registered GNU/Linux user #332525      |     `-       |
+----------------------------------------+--------------+


Other related posts: