]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
setup.sh: Add and use grep_i() - in-place grep.
authorSimon Ruderich <simon@ruderich.org>
Tue, 22 Oct 2013 19:04:14 +0000 (21:04 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 22 Oct 2013 20:59:38 +0000 (22:59 +0200)
setup.sh

index b6bd30e5df9e307e0bc2669d0d7e3ba1324b2039..370bf5c0f7006a708ddf7fe1dce564b2d0fd54cd 100755 (executable)
--- a/setup.sh
+++ b/setup.sh
@@ -22,6 +22,7 @@ set -e
 
 . ../lib.sh
 
 
 . ../lib.sh
 
+
 # Helper functions.
 terminal_info() {
     infocmp "$@" 2>&1
 # Helper functions.
 terminal_info() {
     infocmp "$@" 2>&1
@@ -29,6 +30,9 @@ terminal_info() {
 terminal_available() {
     terminal_info "$@" > /dev/null
 }
 terminal_available() {
     terminal_info "$@" > /dev/null
 }
+grep_i() {
+    cmd_i grep "$@"
+}
 # Check if `infocmp` is available.
 if ! infocmp >/dev/null 2>&1; then
     echo 'Warning: `infocmp` not available! 256color checks will fail.'
 # Check if `infocmp` is available.
 if ! infocmp >/dev/null 2>&1; then
     echo 'Warning: `infocmp` not available! 256color checks will fail.'
@@ -169,16 +173,14 @@ fi
 # "(ROOT)".
 if test "`id -u`" -ne 0; then
     echo screenrc: removing root options
 # "(ROOT)".
 if test "`id -u`" -ne 0; then
     echo screenrc: removing root options
-    grep -v '(ROOT)' screenrc >screenrc.tmp
-    mv screenrc.tmp screenrc
+    grep_i -v '(ROOT)' screenrc
 fi
 # I use some features of GNU screen which are only in Git or very recent GNU
 # screen versions. Drop them on machines which have older versions. They are
 # marked as "(GIT)".
 if test ! -d "$HOME/development/shell/screen"; then
     echo screenrc: removing Git features
 fi
 # I use some features of GNU screen which are only in Git or very recent GNU
 # screen versions. Drop them on machines which have older versions. They are
 # marked as "(GIT)".
 if test ! -d "$HOME/development/shell/screen"; then
     echo screenrc: removing Git features
-    grep -v '(GIT)' screenrc >screenrc.tmp
-    mv screenrc.tmp screenrc
+    grep_i -v '(GIT)' screenrc
 fi
 # Rxvt doesn't need the attrcolor "fix". As I prefer rxvt assume I use it when
 # it's installed.
 fi
 # Rxvt doesn't need the attrcolor "fix". As I prefer rxvt assume I use it when
 # it's installed.
@@ -190,8 +192,7 @@ fi
 # are marked as "(BATTERY)".
 if test ! -d /sys/class/power_supply/BAT0; then
     echo screenrc: removing battery display
 # are marked as "(BATTERY)".
 if test ! -d /sys/class/power_supply/BAT0; then
     echo screenrc: removing battery display
-    grep -v '(BATTERY)' screenrc >screenrc.tmp
-    mv screenrc.tmp screenrc
+    grep_i -v '(BATTERY)' screenrc
 fi
 
 if installed tmux; then
 fi
 
 if installed tmux; then