On Wed, 19 Dec 2001, Joe Pluta wrote: > > > > That's what 'touch' is supposed to do, Joe. People frequently use it to > > create empty files in UNIX environments. > > With invalid names? I didn't think you could create a file called "*.jsp" > in Unix. > Depends on which shell you're using under Unix. I usually use tcsh, and it tells me: % touch *.jsp touch: No match. However, if I do: % touch '*.jsp' % ls -l \** -rw-r--r-- 1 klemscot wheel 0 Dec 19 16:22 *.jsp QSHELL, however, doesn't try to emulate tcsh. It tries to emulate the Bourne Shell, "/bin/sh", so a better test is to try it there: % /bin/sh $ rm \*.jsp $ ls -l \** ls: **: No such file or directory $ touch *.jsp $ ls -l \** -rw-r--r-- 1 scotty wheel 0 Dec 19 16:26 *.jsp As you can see... it does exactly what QSHELL does. As far as "not being able" to create a file with a '*' in it, AFIAK, the only character you CAN'T have in a filename in Unix is '/'. In addition to that, you can't have a file called "." or ".." (though, periods are otherwise allowed in the filename) Beyond that, everything that I know of is legal. Inserting things like '*' is not recommended, because it's confusing, and harder to work with, but it's certainly legal. :)
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.