From: Ian Kelling Date: Wed, 15 Dec 2021 19:33:22 +0000 (-0500) Subject: add quiet flag X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=97f167fc565b8393b38196d2c29a870dd911cac5;p=cedit add quiet flag --- diff --git a/cedit b/cedit index 9b21969..62331b4 100755 --- a/cedit +++ b/cedit @@ -24,6 +24,7 @@ The section is #comment delimited. Reads STDIN for the contents of the section. Without SECTION_NAME, it acts on a global unnamed section. cedit is short for config edit. +-q Quiet -v Verbose -b Keep backup file -h|--help Help" @@ -32,10 +33,12 @@ section. cedit is short for config edit. local exists=true local verbose=false local backup=false + local quiet=false case $1 in -b) backup=true; shift ;; -v) verbose=true; shift ;; + -q) quiet=true; shift ;; -h|--help) echo "$help"; return ;; esac @@ -115,7 +118,7 @@ section. cedit is short for config edit. elif type -t diff &>/dev/null; then diff=$(diff -u "$temp" "$file") ret=$? - if (( $ret )); then + if (( $ret )) && ! $quiet; then echo "backup of original at $temp" echo diff -u "$temp" "$file": echo "$diff"