From b11cfa198df10f9f764f592d08c884a37df8af2c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 30 Aug 2012 19:42:44 +0200 Subject: [PATCH 01/16] zsh/rc: Fix version check for test versions. E.g. 4.3.12-test-2 is newer than 4.3.5. --- zsh/rc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zsh/rc b/zsh/rc index e3434ef..7e817ac 100644 --- a/zsh/rc +++ b/zsh/rc @@ -85,7 +85,7 @@ fi # # At least 4.3.4 (not sure about later versions) has an error in add-zsh-hook # so the compatibility version is used there too. -if [[ $ZSH_VERSION != (4.3.<5->|4.<4->*|<5->*) ]]; then +if [[ $ZSH_VERSION != (4.3.<5->*|4.<4->*|<5->*) ]]; then # Provide add-zsh-hook which was added in 4.3.4. fpath=(~/.zsh/functions/compatibility $fpath) @@ -186,7 +186,7 @@ local default="%{${fg[default]}%}" # vcs_info was added in 4.3.9 but it works in earlier versions too. So load it # if the necessary files are available in ~/.zsh/functions/vcs_info (often a # symbolic link to current checkout of Zsh's sources). -if [[ $ZSH_VERSION == (4.3.<9->|4.<4->*|<5->*) || +if [[ $ZSH_VERSION == (4.3.<9->*|4.<4->*|<5->*) || -d ~/.zsh/functions/vcs_info ]]; then # Update fpath to allow loading the vcs_info functions. if [[ -d ~/.zsh/functions/vcs_info ]]; then @@ -207,7 +207,7 @@ if [[ $ZSH_VERSION == (4.3.<9->|4.<4->*|<5->*) || # is displayed. If there is an special action going on (merge, rebase) # it's also displayed (red). Also display if there are unstaged or staged # (%u/%c) changes. - if [[ $ZSH_VERSION == (4.3.<11->|4.<4->*|<5->*) || + if [[ $ZSH_VERSION == (4.3.<11->*|4.<4->*|<5->*) || -d ~/.zsh/functions/vcs_info ]]; then zstyle ':vcs_info:*' formats \ "($green%b%u%c$default:$blue%s$default)" -- 2.44.2 From c4e301f244c36103c028cf5067fdd8844aa3dbe6 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Thu, 30 Aug 2012 19:47:16 +0200 Subject: [PATCH 02/16] zsh/rc: Don't use add-zsh-hook. Instead append to *_functions directly. Also delete old compatibility file. --- zsh/functions/compatibility/add-zsh-hook | 76 ------------------------ zsh/rc | 19 ++---- 2 files changed, 5 insertions(+), 90 deletions(-) delete mode 100644 zsh/functions/compatibility/add-zsh-hook diff --git a/zsh/functions/compatibility/add-zsh-hook b/zsh/functions/compatibility/add-zsh-hook deleted file mode 100644 index aedc1e7..0000000 --- a/zsh/functions/compatibility/add-zsh-hook +++ /dev/null @@ -1,76 +0,0 @@ -# Add to HOOK the given FUNCTION. -# HOOK is one of chpwd, precmd, preexec, periodic, zshaddhistory, -# zshexit (the _functions subscript is not required). -# -# With -d, remove the function from the hook instead; delete the hook -# variable if it is empty. -# -# -D behaves like -d, but pattern characters are active in the -# function name, so any matching function will be deleted from the hook. -# -# Without -d, the FUNCTION is marked for autoload; -U is passed down to -# autoload if that is given, as are -z and -k. (This is harmless if the -# function is actually defined inline.) - -emulate -L zsh - -local -a hooktypes -hooktypes=(chpwd precmd preexec periodic zshaddhistory zshexit) - -local opt -local -a autoopts -integer del - -while getopts "dDUzk" opt; do - case $opt in - (d) - del=1 - ;; - - (D) - del=2 - ;; - - ([Uzk]) - autoopts+=(-$opt) - ;; - - (*) - return 1 - ;; - esac -done -shift $(( OPTIND - 1 )) - -if (( $# != 2 || ${hooktypes[(I)$1]} == 0 )); then - print "Usage: $0 hook function\nValid hooks are:\n $hooktypes" - return 1 -fi - -local hook="${1}_functions" -local fn="$2" - -if (( del )); then - # delete, if hook is set - if (( ${(P)+hook} )); then - if (( del == 2 )); then - set -A $hook ${(P)hook:#${~fn}} - else - set -A $hook ${(P)hook:#$fn} - fi - # unset if no remaining entries --- this can give better - # performance in some cases - if (( ! ${(P)#hook} )); then - unset $hook - fi - fi -else - if (( ${(P)+hook} )); then - if (( ${${(P)hook}[(I)$fn]} == 0 )); then - set -A $hook ${(P)hook} $fn - fi - else - set -A $hook $fn - fi - autoload $autoopts -- $fn -fi diff --git a/zsh/rc b/zsh/rc index 7e817ac..55e9242 100644 --- a/zsh/rc +++ b/zsh/rc @@ -82,13 +82,7 @@ fi # Simulate hooks using _functions arrays for Zsh versions older than 4.3.4. At # the moment only precmd(), preexec() and chpwd() are simulated. -# -# At least 4.3.4 (not sure about later versions) has an error in add-zsh-hook -# so the compatibility version is used there too. -if [[ $ZSH_VERSION != (4.3.<5->*|4.<4->*|<5->*) ]]; then - # Provide add-zsh-hook which was added in 4.3.4. - fpath=(~/.zsh/functions/compatibility $fpath) - +if [[ $ZSH_VERSION != (4.3.<4->*|4.<4->*|<5->*) ]]; then # Run all functions defined in the ${precmd,preexec,chpwd}_functions # arrays. function precmd() { @@ -108,9 +102,6 @@ if [[ $ZSH_VERSION != (4.3.<5->*|4.<4->*|<5->*) ]]; then } fi -# Autoload add-zsh-hook to add/remove zsh hook functions easily. -autoload -Uz add-zsh-hook - # Load zmv (zsh move) which is a powerful file renamer. autoload -Uz zmv @@ -266,7 +257,7 @@ if [[ $ZSH_VERSION == (4.3.<9->*|4.<4->*|<5->*) || prompt_chpwd() { FORCE_RUN_VCS_INFO=1 } - add-zsh-hook chpwd prompt_chpwd + chpwd_functions+=(prompt_chpwd) # Used by prompt code below to determine if vcs_info should be run. RUN_VCS_INFO=1 @@ -325,7 +316,7 @@ $blue%B'%b$default\ $green%B%n%b$default@$green%B%m%b$default %(1j.$yellow%j$default.)%# \ %(?..($red%B%?%b$default%) )" } -add-zsh-hook precmd prompt_precmd +precmd_functions+=(prompt_precmd) # When screen, tmux, xterm or rxvt is used set the name of the window to the @@ -468,8 +459,8 @@ if [[ $TERM == screen* || $TERM == xterm* || $TERM == rxvt* ]]; then fi # Add the preexec() and precmd() hooks. - add-zsh-hook preexec window_preexec - add-zsh-hook precmd window_precmd + preexec_functions+=(window_preexec) + precmd_functions+=(window_precmd) else # Fallback if another TERM is used, necessary to run screen (see below in # "RUN COMMANDS"). -- 2.44.2 From 3b8b8df44af2f5074cc553bfb39d13c214457fba Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sat, 1 Sep 2012 19:26:51 +0200 Subject: [PATCH 03/16] htoprc: Add Vim modeline. --- htoprc.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htoprc.in b/htoprc.in index 515501d..5dd7d4a 100644 --- a/htoprc.in +++ b/htoprc.in @@ -32,3 +32,5 @@ highlight_threads=1 # Display detailed CPU information, including IO-Wait. detailed_cpu_time=1 + +# vim: ft=cfg -- 2.44.2 From 95bed59790af78aec119b7f6af6c453f042dc2c3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 19 Sep 2012 12:53:34 +0200 Subject: [PATCH 04/16] tmux.conf: Fix load average command. The new command is more portable. --- tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmux.conf b/tmux.conf index 5a69f7a..2d92790 100644 --- a/tmux.conf +++ b/tmux.conf @@ -50,7 +50,7 @@ set-option -g status-bg colour12 # Nothing left of window list. set-option -g status-left "" # Current load average and hostname on the right. -set-option -g status-right "#(uptime | cut -d: -f5- | tr -d ,) #H" +set-option -g status-right "#(uptime | sed 's/^.*load averages*: //; s/,//g') #H" # Format for windows in the window list in the status line. #I window index, # #W window number, #F window flags. -- 2.44.2 From 76bee8c783194e4c5d08772f856c699dc3486d97 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 8 Oct 2012 16:20:20 +0200 Subject: [PATCH 05/16] screenrc,setup.sh: Store temporary files in ~/.tmp/. This prevents cluttering ~/. --- screenrc.in | 2 +- setup.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/screenrc.in b/screenrc.in index 4666ca5..e495774 100644 --- a/screenrc.in +++ b/screenrc.in @@ -126,4 +126,4 @@ bind ; command -c window # Run urlview on current screen content. Very useful to follow links. Make # sure hardcopy_append is off before using this command. -bind ^B eval "hardcopy $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview" +bind ^B eval "hardcopy $HOME/.tmp/screen-urlview" "screen urlview $HOME/.tmp/screen-urlview" diff --git a/setup.sh b/setup.sh index 234b17b..5e5acc6 100755 --- a/setup.sh +++ b/setup.sh @@ -22,6 +22,11 @@ hostname=`hostname` +# Create private temporary directory used by many tools (including GNU screen +# and tmux). +mkdir -p ~/.tmp +chmod 0700 ~/.tmp + # Generate ~/.less with lesskey. lesskey lesskey chmod 0600 ~/.less -- 2.44.2 From 741ed2c1b41ab61b52971b3d4422ebdaa107dde1 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 8 Oct 2012 16:24:39 +0200 Subject: [PATCH 06/16] tmux.conf: Run urlview on current screen content with Ctrl-B. --- tmux.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tmux.conf b/tmux.conf index 2d92790..1083a7f 100644 --- a/tmux.conf +++ b/tmux.conf @@ -82,4 +82,9 @@ bind-key C-] paste-buffer bind-key -t vi-edit C-n history-down bind-key -t vi-edit C-p history-up +# Run urlview on the current screen content. Very useful to follow links. +# Thanks to Arch wiki (https://wiki.archlinux.org/index.php/Tmux) for the +# basic idea. +bind-key C-b capture-pane \; save-buffer ~/.tmp/tmux-urlview \; new-window "$SHELL -c 'urlview < ~/.tmp/tmux-urlview'" + # vim: ft=tmux -- 2.44.2 From acb0c9f9d65e504ef5a30b3c6250e043d92667a3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 5 Sep 2012 15:15:51 +0200 Subject: [PATCH 07/16] tmux.conf: Reduce status line updates to one per minute. --- tmux.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tmux.conf b/tmux.conf index 1083a7f..3a3bb78 100644 --- a/tmux.conf +++ b/tmux.conf @@ -57,6 +57,9 @@ set-option -g status-right "#(uptime | sed 's/^.*load averages*: //; s/,//g') #H set-window-option -g window-status-format "#I #W#F" set-window-option -g window-status-current-format "#I #W#F" +# Update status line commands (#(..)) only every minute. +set-option -g status-interval 60 + # BINDINGS -- 2.44.2 From 87cd0352cf1e8270c2282cc43e300a8ef6582d2f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Wed, 5 Sep 2012 15:16:35 +0200 Subject: [PATCH 08/16] tmux.conf: Add ^a ^t mapping to display current date. --- tmux.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmux.conf b/tmux.conf index 3a3bb78..09c6ed3 100644 --- a/tmux.conf +++ b/tmux.conf @@ -85,6 +85,10 @@ bind-key C-] paste-buffer bind-key -t vi-edit C-n history-down bind-key -t vi-edit C-p history-up +# Display date/time, similar to GNU screen's ^a ^t. Tmux's default ^a t just +# displays the current time, but I often want to know the current date. +bind-key C-t display-message + # Run urlview on the current screen content. Very useful to follow links. # Thanks to Arch wiki (https://wiki.archlinux.org/index.php/Tmux) for the # basic idea. -- 2.44.2 From 859a7d0e85607d62cd93814271e29c87e07b29d6 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 12 Oct 2012 16:41:13 +0200 Subject: [PATCH 09/16] .gitignore: Use leading slash. --- .gitignore | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 84e94fe..1cec4e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Ignore generated files. -htoprc -screenrc +/htoprc +/screenrc # Ignore temporary zsh files. -zsh/cache -zsh/history* +/zsh/cache +/zsh/history* -- 2.44.2 From ab9717d6cf1d9b0d1a5a3e2c932f39e8dd561a7f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 12 Oct 2012 16:41:21 +0200 Subject: [PATCH 10/16] tmux.conf: Use line continuation. Also add new script remove-continuation.pl which performs this change. Older Tmux versions don't support line continuation. Adapt setup.sh to generate tmux.conf from tmux.conf.in. --- .gitignore | 1 + bin/remove-continuation.pl | 42 ++++++++++++++++++++++++++++++++++++++ setup.sh | 1 + tmux.conf => tmux.conf.in | 7 +++++-- 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100755 bin/remove-continuation.pl rename tmux.conf => tmux.conf.in (93%) diff --git a/.gitignore b/.gitignore index 1cec4e7..7d37188 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Ignore generated files. /htoprc /screenrc +/tmux.conf # Ignore temporary zsh files. /zsh/cache /zsh/history* diff --git a/bin/remove-continuation.pl b/bin/remove-continuation.pl new file mode 100755 index 0000000..8658df8 --- /dev/null +++ b/bin/remove-continuation.pl @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +# Remove continuation lines from stdin/file. Leading whitespace on the next +# line is removed. + +# Copyright (C) 2012 Simon Ruderich +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +use strict; +use warnings; + + +my $continuation = 0; +while (my $line = <>) { + # Remove leading whitespace if the last line was a line continuation. + if ($continuation) { + $line =~ s/^\s+//; + } + + if ($line =~ /^(.+?)\\$/) { + print $1; + $continuation = 1; + } else { + print $line; + $continuation = 0; + } +} +# Handle line continuation on the last line. +print "\n" if $continuation; diff --git a/setup.sh b/setup.sh index 5e5acc6..8873bf6 100755 --- a/setup.sh +++ b/setup.sh @@ -93,6 +93,7 @@ fi link inputrc ~/.inputrc link screenrc ~/.screenrc if installed tmux; then + generate perl tmux.conf ./bin/remove-continuation.pl link tmux.conf ~/.tmux.conf fi if installed htop; then diff --git a/tmux.conf b/tmux.conf.in similarity index 93% rename from tmux.conf rename to tmux.conf.in index 09c6ed3..f1fe4e5 100644 --- a/tmux.conf +++ b/tmux.conf.in @@ -50,7 +50,8 @@ set-option -g status-bg colour12 # Nothing left of window list. set-option -g status-left "" # Current load average and hostname on the right. -set-option -g status-right "#(uptime | sed 's/^.*load averages*: //; s/,//g') #H" +set-option -g status-right "#(uptime | sed 's/^.*load averages*: //; s/,//g') \ + #H" # Format for windows in the window list in the status line. #I window index, # #W window number, #F window flags. @@ -92,6 +93,8 @@ bind-key C-t display-message # Run urlview on the current screen content. Very useful to follow links. # Thanks to Arch wiki (https://wiki.archlinux.org/index.php/Tmux) for the # basic idea. -bind-key C-b capture-pane \; save-buffer ~/.tmp/tmux-urlview \; new-window "$SHELL -c 'urlview < ~/.tmp/tmux-urlview'" +bind-key C-b capture-pane \; \ + save-buffer ~/.tmp/tmux-urlview \; \ + new-window "$SHELL -c 'urlview < ~/.tmp/tmux-urlview'" # vim: ft=tmux -- 2.44.2 From bcb93275b56336f67848b9a3bf5044212e530777 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 14 Oct 2012 20:59:57 +0200 Subject: [PATCH 11/16] tmux.conf: Use Tmux's working directory when creating new panes. --- tmux.conf.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmux.conf.in b/tmux.conf.in index f1fe4e5..fe03c16 100644 --- a/tmux.conf.in +++ b/tmux.conf.in @@ -24,6 +24,10 @@ set-option -g history-limit 10000 # Display messages for three seconds. set-option -g display-time 3000 +# Open new windows with the current working directory used when Tmux was +# started, and not the working directory of the current pane. +set-option -g default-path "." + # TERMINAL -- 2.44.2 From 5f758c4b7199c4993bcbe404617c1742fbeb6b4b Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 14 Oct 2012 21:35:41 +0200 Subject: [PATCH 12/16] tmux.conf: Add note how to swap/renumber windows. --- tmux.conf.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tmux.conf.in b/tmux.conf.in index fe03c16..33d1c1e 100644 --- a/tmux.conf.in +++ b/tmux.conf.in @@ -1,4 +1,9 @@ # Tmux configuration file. +# +# Notes: +# +# - To swap/renumber windows (like GNU screen's :number command) use +# :swap-window -t . # Copyright (C) 2011-2012 Simon Ruderich # -- 2.44.2 From 647db2586be6478d0892fc20994135d748460a80 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Sun, 14 Oct 2012 21:58:19 +0200 Subject: [PATCH 13/16] zsh/rc: Ctrl-C doesn't store the line if histignorespace applies. --- zsh/rc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zsh/rc b/zsh/rc index 55e9242..be8e8f5 100644 --- a/zsh/rc +++ b/zsh/rc @@ -601,6 +601,12 @@ bindkey '^F' complete-files # for a fix (-r) to handle whitespace/quotes # correctly, both on the Zsh mailing list. TRAPINT() { + # Don't store this line in history if histignorespace is enabled and the + # line starts with a space. + if [[ -o histignorespace && ${BUFFER[1]} = " " ]]; then + return $1 + fi + # Store the current buffer in the history. zle && print -s -r -- $BUFFER -- 2.44.2 From 6e2852c7dab40a901591a65224d1984a439d29e3 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 15 Oct 2012 21:00:49 +0200 Subject: [PATCH 14/16] setup.sh: Use automic 256color check for GNU screen. --- setup.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/setup.sh b/setup.sh index 8873bf6..c2a56d5 100755 --- a/setup.sh +++ b/setup.sh @@ -20,6 +20,20 @@ . ../lib.sh +# Helper functions. +terminal_info() { + infocmp "$@" 2>&1 +} +terminal_available() { + terminal_info "$@" > /dev/null +} +# Check if `infocmp` is available. +if ! infocmp > /dev/null 2>&1; then + echo 'Warning: `infocmp` not available! 256color checks will fail.' + echo +fi + + hostname=`hostname` # Create private temporary directory used by many tools (including GNU screen @@ -31,10 +45,38 @@ chmod 0700 ~/.tmp lesskey lesskey chmod 0600 ~/.less -# As screen-256color is not widely supported use it only on machines known to -# work. generate cat screenrc .in -if [ $hostname != asp -a $hostname != systemofadown ]; then +# As screen-256color is not widely supported use it only on machines where the +# matching terminfo entry is available. This also requires a terminal emulator +# which supports 256 colors. Also used for tmux. +use_256colors= +if terminal_available screen-256color; then + # Called through SSH connection, assume the local system supports 256 + # colors. + if test -n "$SSH_CONNECTION"; then + use_256colors=1 + # We have rxvt-unicode installed, check if it supports 256 colors. + elif installed urxvt; then + # Thanks to deryni in #rxvt-unicode on Freenode (2012-10-14 22:54 + # CEST) for the strings/grep idea. The grep check is for "correct" 256 + # rxvt-unicode binaries (e.g. Debian's rxvt-unicode-256color), the + # terminal_info check for manual installations which modify + # rxvt-unicode's terminfo entry. + urxvt_path=`which urxvt` + urxvt_grep=`strings "$urxvt_path" | grep '^TERM=rxvt-')` + if test x"$urxvt_grep" = 'xTERM=rxvt-unicode-256color' \ + || terminal_info rxvt-unicode \ + | grep -F 'colors#256' >/dev/null; then + use_256colors=1 + fi + # Check if XTerm supports 256 colors (not a perfect check, but most XTerm + # support 256 colors). + elif terminal_available xterm-256color; then + use_256colors=1 + fi +fi +if test -z "$use_256colors"; then + echo screenrc: removing 256 colors sed 's/Enable 256 color/Disable 256 color/; s/screen-256color/screen/' screenrc > screenrc.tmp mv screenrc.tmp screenrc -- 2.44.2 From 6b3da4f032ce15fb6d8557e72b0e6611e2476e59 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 15 Oct 2012 21:02:41 +0200 Subject: [PATCH 15/16] setup.sh: Improve check for Git version of GNU screen. --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index c2a56d5..305c093 100755 --- a/setup.sh +++ b/setup.sh @@ -90,7 +90,7 @@ if [ x`id -u` != x0 ]; then fi # I use some features of screen which are only in Git. Drop them on machines # which have older versions. They are marked as "(GIT)". -if [ $hostname != asp -o x`id -u` = x0 ]; then +if test -d "$HOME/development/shell/screen"; then echo screenrc: removing Git features grep -v '(GIT)' screenrc > screenrc.tmp mv screenrc.tmp screenrc -- 2.44.2 From 90691ed2f737abfe5e591e7971501a60fa72ac9c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 15 Oct 2012 21:04:34 +0200 Subject: [PATCH 16/16] setup.sh: Use test instead of [. Also fix a comparison, `id -u` is a number. --- setup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 305c093..aa323ac 100755 --- a/setup.sh +++ b/setup.sh @@ -83,7 +83,7 @@ if test -z "$use_256colors"; then fi # Some options are only necessary when running as root. They are marked as # "(ROOT)". -if [ x`id -u` != x0 ]; then +if test "`id -u`" -ne 0; then echo screenrc: removing root options grep -v '(ROOT)' screenrc > screenrc.tmp mv screenrc.tmp screenrc @@ -104,7 +104,7 @@ if installed rxvt; then fi # Display current battery charge on computers with a battery. Necessary lines # are marked as "(BATTERY)". -if [ ! -d /sys/class/power_supply/BAT0 ]; then +if test ! -d /sys/class/power_supply/BAT0; then echo screenrc: removing battery display grep -v '(BATTERY)' screenrc > screenrc.tmp mv screenrc.tmp screenrc -- 2.44.2