
#adjustscript inserts a suitable default definition of a configuration
#option into a script. Input is excepected on stdin, output is sent to stdout.
#
# 'adjuscript VAR good' will change a line looking like this:
#
#     defaultVAR="anything"
#
# (where anything is anything) into
#
#     defaultVAR="good"
#
# It also replaces references to /bin/bash with the actual path to bash

[ $# = 2 ] || {
  echo >&2 "Usage: adjustscript <varible> <default>"
  exit 1
}

bash=`which bash`
[ -n "$bash" ] || bash=/bin/bash # Report error!

sed -e "s%/bin/bash%$bash%" -e "s%default$1=\"[^\"]*\"%default$1=\"$2\"%"
