Guest User

cfg.writer

a guest
May 11th, 2010
512
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cfg.writer ()
  2. {
  3.     IFS=' '$'\n'
  4.     fun="$(declare -F)"
  5.     fun="${fun//declare -f/}"
  6.     for f in $fun; do
  7.         [ "${f#cfg.section}" == "${f}" ] && continue
  8.         item="$(declare -f ${f})"
  9.         item="${item##*\{}"
  10.         item="${item%\}}"
  11.         item="${item//=*;/}"
  12.         vars="${item//=*/}"
  13.         eval $f
  14.         echo "[${f#cfg.section.}]"
  15.         for var in $vars; do
  16.             echo $var=\"${!var}\"
  17.         done
  18.     done
  19. }
RAW Paste Data