From 97f167fc565b8393b38196d2c29a870dd911cac5 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 15 Dec 2021 14:33:22 -0500 Subject: [PATCH] add quiet flag --- cedit | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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" -- 2.30.2