If you want to (for example) cd to a file starting with a dash (some mac users tend to use weird filenames like "-folder" ). do
$cd ./-folder
maandag 30 juni 2008
removing files matching a certain pattern
from the xargs man:
delete all .svn folder
$find /somedir -name .svn -print0 | xargs -0 /bin/rm -rf
xargs comes in handy when handling great amounts of files.
delete all .svn folder
$find /somedir -name .svn -print0 | xargs -0 /bin/rm -rf
xargs comes in handy when handling great amounts of files.
donderdag 26 juni 2008
replacing text in a bunch of files matching a certain pattern
Replace comes with mysql. It's a handy tool for sed/awk n00bs. This one I used to change some static paths while excluding all .svn folders and logfiles.
~$ replace '/var/www/mydir' '/var/www/newdir/' -- `grep --exclude-dir=.svn --exclude=*.log -clr "/var/www/mydir" ./*`
Of course there are other/better ways to accomplish this, look at this
http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html
~$ replace '/var/www/mydir' '/var/www/newdir/' -- `grep --exclude-dir=.svn --exclude=*.log -clr "/var/www/mydir" ./*`
Of course there are other/better ways to accomplish this, look at this
http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html
dinsdag 24 juni 2008
donderdag 19 juni 2008
page up / page down bash
add these lines to your /etc/inputrc to search backwards through history. It searches on the string already typef
"\e[5~": history-search-backward
"\e[6~": history-search-forward
woensdag 18 juni 2008
example post commit hook
Sample script for a conditional post-commit hook in bash. This post-commit hook updates a local copy (www directory) to the latest revision when files are changed within a certain directory.
#!/bin/bash
umask 0002
REPOS=$1
REV=$2
MATCH=`/usr/bin/svnlook -r $REV dirs-changed $REPOS | /bin/grep -c "just a string"`
if [ $MATCH -gt 0 ];then
/usr/bin/svn update /var/www/projects/mysite
fi
maandag 16 juni 2008
Never create a PagesController in Cake
While fiddling with cake. I got some weird error in my PagesController:
Whatever I did, it kept asking for a default view. After some searching it seems the PagesController is reserved for cake itself.
Reference: http://logs.cakephp.nu/cakephp/chat.log.2007-06-26
You are seeing this error because the action display is not defined in controller PagesController"
Whatever I did, it kept asking for a default view. After some searching it seems the PagesController is reserved for cake itself.
Reference: http://logs.cakephp.nu/cakephp/chat.log.2007-06-26
Abonneren op:
Posts (Atom)