- local s diff name init
- local file_dir="$(dirname "$file")"
- local exists=true
- local verbose=false
-
- case $1 in
- -v) verbose=true; shift ;;
- -h|--help) echo "$help"; return ;;
- esac
-
- if (( $# == 2 )); then
- name=": $1"
- shift
- fi
-
- local file="$1"
- local file_name="${file##*/}"
-
- local begin="#_#_# start delimiter of cedit section$name. do not modify. #_#_#"
- local end="#_#_# end delimiter of cedit section$name. do not modify. #_#_#"
-
- if [[ ! -e $file_dir ]]; then
- if ! mkdir -p $file_dir; then
- s=sudo
- $s mkdir -p $file_dir || return 1
- fi
+ local s diff name init file_dir exists verbose backup quiet silent
+ file_dir="$(dirname "$file")"
+ exists=true
+ verbose=false
+ backup=false
+ quiet=false
+ silent=false
+ exit_status=true
+
+ case $1 in
+ -b) backup=true; shift ;;
+ -e) exit_status=false; shift ;;
+ -s) quiet=true; silent=true; exit_status=false; shift ;;
+ -q) quiet=true; shift ;;
+ -v) verbose=true; shift ;;
+ -h|--help) echo "$help"; return ;;
+ esac
+
+ if (( $# == 2 )); then
+ name=": $1"
+ shift
+ fi
+
+ local file="$1"
+ local file_name="${file##*/}"
+
+ local comment
+ comment="#_#_#"
+
+ # bind zone files use ; for comments yes, a little hacky detection.
+ if [[ $file_name == db.* ]]; then
+ comment=";;_;_;"
+ fi
+ local begin="$comment start delimiter of cedit section$name. do not modify. $comment"
+ local end="$comment end delimiter of cedit section$name. do not modify. $comment"
+
+ if [[ ! -e $file_dir ]]; then
+ if ! mkdir -p $file_dir; then
+ s=sudo
+ $s mkdir -p $file_dir || return 2