The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Deleting end of line $ character in file bwrynz1 UNIX for Advanced & Expert Users 3 01-08-2008 10:17 AM
Special character in my file Ryan2786 UNIX for Dummies Questions & Answers 3 07-05-2007 08:35 PM
delete a special character in file srivsn Shell Programming and Scripting 1 03-15-2006 03:45 AM
delete a special character in file srivsn Shell Programming and Scripting 3 03-07-2006 05:18 AM
Mount a character special file MuellerUrs SUN Solaris 1 07-15-2005 09:36 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 12-07-2005
Registered User
 

Join Date: Dec 2005
Posts: 2
Problem deleting file with special character

I'm having problems deleting a file with a special character and I'm hoping that somebody here can help. The file "-osample1.c" will not remove from my directory. Here is an example of what happens. Any ideas would be appreciated.

> ls *sample1*
ls: illegal option -- .
usage: ls -1ARadeCxmnlogrtucpFLbqisf [files]
> ls
-osample1.o demo_proc.mk makefile test.sh test1.c test1.o testing
asdf.log inst scripts test1 test1.lis test1.pc
> rm *sample1*
rm: illegal option -- o
rm: illegal option -- s
rm: illegal option -- a
rm: illegal option -- m
rm: illegal option -- p
rm: illegal option -- l
rm: illegal option -- e
rm: illegal option -- 1
rm: illegal option -- .
rm: illegal option -- o
Usage: rm [-Rfir] file ...
> rm -osample1.o
rm: illegal option -- o
rm: illegal option -- s
rm: illegal option -- a
rm: illegal option -- m
rm: illegal option -- p
rm: illegal option -- l
rm: illegal option -- e
rm: illegal option -- 1
rm: illegal option -- .
rm: illegal option -- o
Usage: rm [-Rfir] file ...
Reply With Quote
Forum Sponsor
  #2  
Old 12-07-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
From man sh

Code:
       --        A -- signals the end of options and disables  further  option
                 processing.   Any arguments after the -- are treated as file-
                 names and arguments.  An argument of - is equivalent to --.
Look at this

Code:
sh-2.05b$ touch -- -123
sh-2.05b$ ls -l -- -123
-rw-r--r--    1 abcdefgh g900            0 Dec  7 07:17 -123
sh-2.05b$ rm  -- -123
sh-2.05b$ ls -l -- -123
ls: -123: No such file or directory
sh-2.05b$
Reply With Quote
  #3  
Old 12-07-2005
Registered User
 

Join Date: Dec 2005
Posts: 2
Worked like a charm Thanks for the help Vino!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0