Your Ad Here

IBM AIX/UNIX system storage administration ksh/perl scripting

Sunday, June 22, 2008

How to delete file with special characters

Sometimes some people create a file with special character like "-s" in the filename.

If you use

 rm -s 

or
 rm "-s" 


You will get an error that '-s' is not a valid parameter.

You can add a "--" before the filename.


Example:
Display its content:
cat -- -s

List the file:
ls -l -- -s

Delete the file:
rm -- -s

No comments:

Labels

BlogCatalog