From d30e0e8afa67eeb9f7163c71bbd6bc568ad5e1b6 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 22 Oct 2013 21:04:14 +0200 Subject: [PATCH] setup.sh: Add and use grep_i() - in-place grep. --- setup.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/setup.sh b/setup.sh index b6bd30e..370bf5c 100755 --- a/setup.sh +++ b/setup.sh @@ -22,6 +22,7 @@ set -e . ../lib.sh + # Helper functions. terminal_info() { infocmp "$@" 2>&1 @@ -29,6 +30,9 @@ terminal_info() { 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.' @@ -169,16 +173,14 @@ fi # "(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 - 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. @@ -190,8 +192,7 @@ fi # 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 -- 2.45.2