#!/bin/bash PORTPATH=$(port dir gsocdummy 2>/dev/null) if [[ ! $PORTPATH ]]; then echo "Error: can't find gsoc-dummy port directory"; exit 1; fi read _ revision <<< $(cat "$PORTPATH"/Portfile | grep revision) echo -n "Switching gsocdummy from revision " cd "$PORTPATH" if [[ $revision = 0 ]]; then echo "0 to 1" sed -e 's,\(revision[ ]*\)0,\11,' -i '' Portfile else echo "1 to 0" sed -e 's,\(revision[ ]*\)1,\10,' -i '' Portfile fi #cp Portfile Portfile.backup #mv NewPortfile Portfile