Posts tonen met het label bash. Alle posts tonen
Posts tonen met het label bash. Alle posts tonen

vrijdag 5 juni 2009

svn mv html to php rename bash

for i in $(ls *.html); do svn mv $i `echo $i | sed s/html/php/`; done;

maandag 30 juni 2008

filenames beginning with a - (dash)

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

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.

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