From: sev Date: Thu, 26 Dec 2024 21:27:41 +0000 (-0600) Subject: zsh: replace subshells with list execution X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/commitdiff_plain/27a346435eaae9c38ce54dfdf899872b2cf6860d zsh: replace subshells with list execution subshells were used accidentally during conversion to alternate form statements --- diff --git a/etc/zsh/.zprofile b/etc/zsh/.zprofile index 3aedb8c..3ade322 100644 --- a/etc/zsh/.zprofile +++ b/etc/zsh/.zprofile @@ -179,7 +179,7 @@ if [[ ! -v _sev_setup_ssh ]] { if [[ -f $e ]] { IFS=$'\0' read -r sock pid <$e } - if ([[ -S $sock && $pid > 0 ]] && kill -0 $pid >/dev/null 2>&1) { + if {[[ -S $sock && $pid > 0 ]] && kill -0 $pid >/dev/null 2>&1} { [[ -o interactive ]] && print -P "Reusing agent PID $pid%f" export SSH_AUTH_SOCK=$sock export SSH_AGENT_PID=$pid diff --git a/etc/zsh/.zshenv b/etc/zsh/.zshenv index 2d419ee..f97424c 100644 --- a/etc/zsh/.zshenv +++ b/etc/zsh/.zshenv @@ -19,7 +19,7 @@ function _sev_zcleanup { # NOTE: called before setup and on logout: remove the dir we # will be using (it's stale) or the dir we did use, and any # dead sessions if present - if (_sev_checkpid ${x:t}) { + if {_sev_checkpid ${x:t}} { find $x -mindepth 1 -maxdepth 1 | while {read -r y} { # XXX: real dirs will stop unlink, consider it a feature unlink $y @@ -43,7 +43,7 @@ function _sev_zcleanup { find -L $_sev_tmp -mindepth 1 -maxdepth 1 -name '.session.*' -type d | while {read -r x} { # NOTE: same rationale as above - if (_sev_checkpid ${${x:t}#.session.}) { + if {_sev_checkpid ${${x:t}#.session.}} { rm -rf $x } } @@ -209,7 +209,7 @@ if [[ ! -v _sev_tmp ]] { _t=$_sev_tmp/.session.$$ # XXX: we probably shouldn't allow the use of an existing dir—tmp dir for # current pid should have been removed by zcleanup - if ([[ ! -d $_t ]] && ! mkdir -m700 $_t 2>/dev/null) { + if {[[ ! -d $_t ]] && ! mkdir -m700 $_t 2>/dev/null} { [[ -o interactive ]] && print -P "%F{red}!!! Can't create session tmp subdir $_t, using $_sev_tmp%f" _t=$_sev_tmp diff --git a/etc/zsh/.zshrc b/etc/zsh/.zshrc index d71861e..025ba86 100644 --- a/etc/zsh/.zshrc +++ b/etc/zsh/.zshrc @@ -143,7 +143,7 @@ if [[ ! -v _sev_force_zkbd && ( -v terminfo || -v termcap ) ]] { } find_keymap if [[ -z $keymap ]] { - if (read -q "?Can't read terminfo. Add new zkbd keymap? [y/N]") { + if {read -q "?Can't read terminfo. Add new zkbd keymap? [y/N]"} { echo { autoload -Uz zkbd && zkbd