On Tue, Mar 04, 2003 at 12:39:47PM -0600, Gianfranco Berardi wrote: > In the glob(7) man page, you find the following: > > >Ranges > >There is one special convention: two characters separated by `-' > denote >a range. (Thus, `[A-Fa-f0-9]' is > >equivalent to `[ABCDEFabcdef0123456789]'.) One may include `-' in its > >literal meaning by making it the > >first or last character between the brackets. (Thus, `[]-]' >matches > just the two characters `]' and `-', > >and `[--/]' matches the three characters `-', `.', `/'.) > > However, when you run the following command: > > $ ls myfile[--/]txt
here, you're talking to your command shell. that's likely to be similar to yet different from what you find in "man 7 glob". > it will say > > ls: myfile[--/]txt:No such file or directory > > However, > > $ ls myfile [-.]txt you probably mean "myfile[-.]txt" without the space, right? > returns myfile.txt and myfile-txt if they exist. > > Since file names can't have a '/' in them, is the man page just written > strangely/incorrectly or am I just not using this the way it was meant > to be used? they're discussing ascii sequences, that's all. in ascii, "-" is chr(45) and "/" is chr(47) -- between them we have "." which is chr(46). also they were showing how to include a hyphen as an endpoint of a range, which is not something to depend on if you're worried about script portability. > I tried to see if other people had issues with this but Google didn't > return anything but HTML versions of man pages or information on how > glob was a security risk on ftp servers. to see how your shell works with globbing, check the manpage of your particular shell-- man bash man tcsh man zsh and search for glob (type /glob to do so). there's the globbing you're actually using, and its behavior may be a bit different from the glob routine described in man 7. your shell will also have all kinds of extras that you can turn on or off or just generally fiddle with. (the cool part is, i didn't even know a) glob had its own manpage, let alone two (sections 3 and 7) and b) that you could use classes [a-z] in glob expressions, until i perused your note. learn something new every day!) -- I use Debian/GNU Linux version 3.0; Linux server 2.4.20-k6 #1 Mon Jan 13 23:49:14 EST 2003 i586 unknown DEBIAN NEWBIE TIP #45 from Will Trillich <[EMAIL PROTECTED]> : Troubled by DOS-FORMAT TEXT FILES? There are many ways to get rid of the extra ^M characters. In VIM, try :set ff=unix before saving the file (":opt" for more info); or, use perl: perl -pi.dos -e 's/\cM//g' filename*pattern.txt ("perldoc perlrun" for more info.) Also see http://newbieDoc.sourceForge.net/ ... -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]