various fixes, mostly for etiona
[distro-setup] / brc
diff --git a/brc b/brc
index b5d45969c67b9364d6dfc783d187be1873d27707..51a04dcac0d59c3a29bd081522ee11a51dc738da 100644 (file)
--- a/brc
+++ b/brc
@@ -317,7 +317,7 @@ cam() {
 
 
 ccat () { # config cat. see a config without extra lines.
-  grep '^\s*[^;[:space:]#]' "$@"
+  grep '^\s*[^;[:space:]#]' "$@" || [[ $? == 1 ]]
 }
 
 
@@ -768,11 +768,11 @@ lower() { # make first letter of filenames lowercase.
 
 
 k() { # history search
-  grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history}  | tail -n 80;
+  grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history}  | tail -n 80 || [[ $? == 1 ]];
 }
 
 ks() { # history search
-  grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history}  | uniq;
+  grep -P --binary-files=text "$@" ${HISTFILE:-~/.bash_history}  | uniq || [[ $? == 1 ]];
 }
 
 
@@ -812,7 +812,7 @@ pkx() { # package extract
   c $(mktemp -d)
   pkg=$1
   # shellcheck disable=SC2012
-  cached=$(ls -t /var/cache/apt/archives/$pkg* | tail -n1 2>/dev/null)
+  cached=$(ls -t /var/cache/apt/archives/$pkg* | tail -n1 2>/dev/null) ||:
   if [[ $cached ]]; then
     cp $cached .
   else