Ralf Hemmecke wrote: > > > Try in initally empty directory: > > > > touch warm.data > > (export LANG=en_US.UTF8 ; rm [A-Z]*.data ) > > ls warm.data > > Ooops. But then your fix is not a fix. > > mkdir tmp-test > cd tmptest > for f in a b c d e f g h i j k l m n o p q r s t u v w x y z; do touch > "$f$f$f".data; done > (export LANG=en_US.UTF-8; /bin/rm [A-Z]*.data) > ls > aaa.data >
Well, the point is that the only affected file is 'warm.data': in 'clean' we want to remove all files produced during build, but preserve file present in original tree. So, we do not care what exactly is matched by shell glob. We care that files we want to delete match and no original source files match. > Isn't that a bug? Globbing should work differently. > http://linux.about.com/library/cmd/blcmdl7_glob.htm > Shell globbing is defined by POSIX. The page above looks like tutorial which gives half-truth for newbies, but I would not treat it as authoritative reference (POSIX is quite explicit describing effects of locale, while the page above completely ignores them). > Oh, it looks like it is a bug (or feature) in bash. > > /bin/dash > $ for f in a b c d e f g h i j k l m n o p q r s t u v w x y z; do touch > "$f$f$f".data; done > $ > $ ls > aaa.data eee.data iii.data mmm.data qqq.data uuu.data yyy.data > bbb.data fff.data jjj.data nnn.data rrr.data vvv.data zzz.data > ccc.data ggg.data kkk.data ooo.data sss.data www.data > ddd.data hhh.data lll.data ppp.data ttt.data xxx.data > $ (export LANG=en_US.UTF-8; /bin/rm [A-Z]*.data) > /bin/rm: cannot remove `[A-Z]*.data': No such file or directory > $ ls > aaa.data eee.data iii.data mmm.data qqq.data uuu.data yyy.data > bbb.data fff.data jjj.data nnn.data rrr.data vvv.data zzz.data > ccc.data ggg.data kkk.data ooo.data sss.data www.data > ddd.data hhh.data lll.data ppp.data ttt.data xxx.data > > As a fix for bash, you'd simply have to put some quotes around the glob > pattern. > > for f in a b c d e f g h i j k l m n o p q r s t u v w x y z; do touch > "$f$f$f".data; done > (export LANG=en_US.UTF-8; /bin/rm "[A-Z]*.data") > /bin/rm: cannot remove `[A-Z]*.data': No such file or directory > trex:~/scratch/test-waldek>ls > aaa.data eee.data iii.data mmm.data qqq.data uuu.data yyy.data > bbb.data fff.data jjj.data nnn.data rrr.data vvv.data zzz.data > ccc.data ggg.data kkk.data ooo.data sss.data www.data > ddd.data hhh.data lll.data ppp.data ttt.data xxx.data > No, the above does not remove files with names like A.data, once you quote the name you get literal match with no globbing. -- Waldek Hebisch [email protected] -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.
