A discussion today was about error handling in shell scripts, Bash in particular.
Well, we all know about the usual knitpicks about error handling and the possible consequences in not doing so properly ![]()
Read more…
wipe out directory tree through rsync
To wipe out a directory tree on a rsync server (an export) which you don’t have shell access to (but proper write access of course), just use this command:
# rsync -av –delete /tmp/clear.me/ rsync://some.rsync.host/some.export/
/tmp/clear.me is an example for a local but empty directory (empty as in ‘mkdir /tmp/clear.me).
Putting the slashes at the end of both local and remote path will allow you to sync the empty directory onto the server, effectively removing everything on the receiver side.
Imagine you have a directory with thousands of text files, each of which containing some keywords to be replaced.
While there’s a lot of tools out there allowing you to find and replace strings in text files, there’s always a goog reason to use the tools that you already have.
The following snippet uses find in combination with perl to achieve the task:
Read more…
