Path: utzoo!attcan!uunet!decwrl!ucbvax!THEP.LU.SE!magnus From: magnus@THEP.LU.SE (Magnus Olsson) Newsgroups: comp.misc Subject: [] in Unix filenames Message-ID: <9009191420.AA10971@thep.lu.se> Date: 19 Sep 90 14:25:31 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 54 I was going to post the following question to comp.unix.shell, but I'm posting via mail to ucbvax, and apparently ucbvax hasn't got an alias for that newsgroup yet, so the letter just bounced. Hence I'm posting to comp.misc instead. I'm sorry for the inconvenience this may cause all the non-Unix readers of comp.misc. Please don't flame me, it's not my fault. _________________________________________________________________________________ Today, I was asked to help a colleague with the following problem: He'd used ftp to get some files from a VAX under VMS. Now, the VAX files were in a subdirectory, so he wrote something like mget [.subdir]*.* only to find that his Unix directory had a lot of files called things like [.subdir]file1 [.subdir]file2 etc (about 20 of them), and that he couldn't access them (since the shell catches the [] pair). OK, I thought, I;ll just use the mved script published here some time ago and do mved \[*\]= = (the = is a special wildcard recognized by mved - the command would mean the same as mv \[.subdir\]file1 file1 etc.) But to my surprise, the shell just said "[: no such file or directory". Actually, I couldn't find out *any* combination of backslashes and or quotes that enabled me to get what I wanted (what [*] would have meant if [] weren't special characters). Finally, I gave up and wrote a C program to do the job. Is there really no way of telling the shell that I mean "all files that start with a [, followed by an arbitrary string, followed by a ], etc? Or is this a bug in the shell (we're using newcsh)? Magnus Olsson | \e+ /_ Dept. of Theoretical Physics | \ Z / q University of Lund, Sweden | >----< Internet: magnus@thep.lu.se | / \===== g Bitnet: THEPMO@SELDC52 | /e- \q