Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!sdd.hp.com!hp-col!hpldola!hp-lsd!jimr From: jimr@hp-lsd.COS.HP.COM (Jim Rogers) Newsgroups: comp.unix.shell Subject: Re: Stupid question... Message-ID: <27620012@hp-lsd.COS.HP.COM> Date: 28 May 91 22:46:23 GMT References: <1991May27.225630.18310@watdragon.waterloo.edu> Organization: HP Logic Systems Division - Col Lines: 47 The reason you are having trouble with files beginning with "-" is that this character is used by the rm command to signify an option. It is specifically excluded as a valid first character for a file name, as far as the "rm" command is concerned. What you need is an rm-like command which has no options. The following short peice of C code will do the trick. I called it dumbrm because it is not smart enough to have any options. /************************************************************************* * This program will remove a file with any character in the file name * because it has no options. **************************************************************************/ #include main(argc, argv) int argc; char *argv[]; { int count; char answer[20]; for(count = argc - 1; count > 0; count--) { fprintf(stderr,"Remove %s ? ", argv[count]); gets(answer); if (answer[0] == 'y' || answer[0] == 'Y') { if (unlink(argv[count]) != 0) { perror(argv[0]); } } } } Jim Rogers Hewlett-Packard Company Any opinion expressed or implied by this message are the sole responsibility of the individual(s) above named and have no connection with any opinion, real or imagined, expressed by my employer or any living individual.