Skip to content

Instantly share code, notes, and snippets.

@terrycojones
Created September 14, 2012 21:13
Show Gist options
  • Save terrycojones/3724876 to your computer and use it in GitHub Desktop.
Save terrycojones/3724876 to your computer and use it in GitHub Desktop.
#!/bin/sh
file=/etc/postgresql/9.1/main/postgresql.conf
current=`egrep "^[ ]*bytea_output[ ]*=" $file | tr -d "' " | cut -f1 -d\# | tr = ' ' | cut -f2 -d' '`
case "$current" in
'' ) echo "bytea_output = 'escape'" >> $file ;;
escape) ;; # Do nothing, the existing value is correct.
hex) echo "Incompatible setting: $current"; exit 1;;
*) echo "wtf.... unknown value $current"; exit 2;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment