Kung Fu Kung Fu

Fujian White Crane Kung Fu

Zope Zope

What I have and am doing with Zope

Photos Photos

Photoalbum, both old and new.

Receptsamlingen Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me Contact me

My contact details and how to contact me.

  Mobile version of this page Mobile version of this page


 

File check before delete

bash, rm, remove

6th of March 2008

Because I always forget, here's how to check if a file exists before attempting to delete it in bash:

 [ -f foobar.html ] && rm foobar.html

If you don't do it this way and the file doesn't exist you get this:

 rm: cannot remove `foobar.html': No such file or directory


Comment

ivo - 6th March 2008  [«« Reply to this]
rm -f foobar.html will not complain if the file doesn't exist
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.