From 024e9c469de634181ec77eb52420f25339f4f01e Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Tue, 9 Jul 2024 17:39:25 +0200 Subject: [PATCH] fix: limit shellscript line length to 78 chars --- files/dom0/.local/bin/dom0/xfce-xkb-global | 6 +-- files/git/.config/git/shell/list | 3 +- .../git/template/hooks/pre-receive.sample | 53 ++++++++++--------- .../git/template/hooks/prepare-commit-msg | 4 +- files/git/.local/bin/git-client-setup | 6 ++- files/git/.local/bin/git-server-setup | 4 +- files/sh/.config/bash/bashrc | 11 +++- files/sh/.config/sh/profile | 6 ++- files/sh/.config/sh/shrc | 13 +++-- files/sh/.config/zsh/.zshrc | 39 +++++++++----- files/sh/.local/bin/resize-terminal | 4 +- files/tmux/.local/bin/ta | 6 ++- 12 files changed, 97 insertions(+), 58 deletions(-) diff --git a/files/dom0/.local/bin/dom0/xfce-xkb-global b/files/dom0/.local/bin/dom0/xfce-xkb-global index 9205766..d0c14a3 100755 --- a/files/dom0/.local/bin/dom0/xfce-xkb-global +++ b/files/dom0/.local/bin/dom0/xfce-xkb-global @@ -12,9 +12,9 @@ ## - editing the "panel" and adding "keyboard layouts" plugin. After adding ## the plugin, right click on it and edit its properties. Set "manage ## layout" to globally. -## - editing the plugin directly in the "settings editor", search for plugin-n, -## where "n" is a number we don't know and its value is "kxb", search for -## group-policy and set it to "0". +## - editing the plugin directly in the "settings editor", search for +## plugin-n, where "n" is a number we don't know and its value is "kxb", +## search for group-policy and set it to "0". ## - editing the plugin values via commandline with "xfconf" and set ## "group-policy" value to "0". set -eu diff --git a/files/git/.config/git/shell/list b/files/git/.config/git/shell/list index c4ad34d..fd48c34 100755 --- a/files/git/.config/git/shell/list +++ b/files/git/.config/git/shell/list @@ -34,7 +34,8 @@ fi # shellcheck disable=SC2016 print_bare=' - test "$(git -C "$1" rev-parse --is-bare-repository)" = true && printf "%s\n" "${1}" + test "$(git -C "$1" rev-parse --is-bare-repository)" = true && + printf "%s\n" "${1}" ' # shellcheck disable=SC2154 diff --git a/files/git/.config/git/template/hooks/pre-receive.sample b/files/git/.config/git/template/hooks/pre-receive.sample index 51c9ca3..d7267fe 100755 --- a/files/git/.config/git/template/hooks/pre-receive.sample +++ b/files/git/.config/git/template/hooks/pre-receive.sample @@ -4,7 +4,7 @@ # # SPDX-License-Identifier: AGPL-3.0-or-later -## Force signature verification for everything that can be signed. +## Force signature validation for everything that can be signed. ## - signed pushes (if the server is configured to receive it); ## - signed commits, unsigned commit can be validated by a signed tag pointing ## to the commit; @@ -35,9 +35,13 @@ zero="$(git hash-object --stdin &2 +} + require_signed_push(){ if test -z "${GIT_PUSH_CERT-}"; then - echo "Pushes must be signed but client didn't sign it." >&2 + err "Pushes must be signed but client didn't sign it." exit 1 fi @@ -51,17 +55,17 @@ check_signed_push(){ fi if test "${GIT_PUSH_CERT_STATUS}" = "G"; then - true "Certificate verification succeeded with key: ${GIT_PUSH_CERT_KEY}" + true "Cert validation succeeded. Key: ${GIT_PUSH_CERT_KEY}" else - echo "Certificate verification failed with status: ${GIT_PUSH_CERT_STATUS}" >&2 - echo "Certificate key: ${GIT_PUSH_CERT_KEY}" >&2 + err "Cert validation failed. Status: ${GIT_PUSH_CERT_STATUS}" + err "Cert key: ${GIT_PUSH_CERT_KEY}" exit 1 fi if test "${GIT_PUSH_CERT_NONCE_STATUS}" = "OK"; then - true "Certificate nonce verification succeeded with nonce: ${GIT_PUSH_CERT_NONCE}" + true "Cert nonce validation succeeded. Nonce: ${GIT_PUSH_CERT_NONCE}" else - echo "Certificate nonce verification failed with status: ${GIT_PUSH_CERT_NONCE_STATUS}" >&2 + err "Cert nonce validation failed. Status: ${GIT_PUSH_CERT_NONCE_STATUS}" exit 1 fi } @@ -94,17 +98,17 @@ check_signed_push_keyring(){ gpg_ec="$?" gpg_sig="$(echo "$gpg_out" | awk '/ GOODSIG /{print $3}')" if test "$gpg_ec" = "0"; then - true "Certificate verification succeeded with key: $gpg_sig" + true "Cert validation succeeded. Key: $gpg_sig" else - echo "Certificate verification failed. Verification output:" >&2 - echo "$gpg_out" >&2 + err "Cert validation failed. Verification output:" + err "$gpg_out" fi rm -rf "$tmpdir" if test "${GIT_PUSH_CERT_NONCE_STATUS}" = "OK"; then - true "Certificate nonce verification succeeded with nonce: ${GIT_PUSH_CERT_NONCE}" + true "Cert nonce validation succeeded. Nonce: ${GIT_PUSH_CERT_NONCE}" else - echo "Certificate nonce verification failed with status: ${GIT_PUSH_CERT_NONCE_STATUS}" >&2 + err "Cert nonce validation failed. Status: ${GIT_PUSH_CERT_NONCE_STATUS}" exit 1 fi } @@ -127,24 +131,24 @@ while read -r oldrev newrev ref; do obj_type="$(git cat-file -t "$newrev")" if test "$obj_type" = "tag"; then if git verify-tag "$newrev" >/dev/null 2>&1; then - true "Tag verification succeeded for tag: $newrev" + true "Tag validation succeeded for tag: $newrev" else obj_rejected="${obj_rejected-} $newrev " continue fi commit_tag="$(git rev-list -n1 "$newrev")" obj_rejected="$(echo "$obj_rejected" | sed "s/ $commit_tag //")" - echo "Commit verification done by tag: $commit_tag $newrev" >&2 + err "Commit validation done by tag: $commit_tag $newrev" continue fi for obj in $objects; do if git verify-commit "$obj" >/dev/null 2>&1; then - true "Commit verification succeeded commit: $obj" + true "Commit validation succeeded commit: $obj" continue else - echo "No valid signature in commit: $obj" >&2 + err "No valid signature in commit: $obj" obj_rejected="${obj_rejected-} $obj " fi @@ -153,8 +157,9 @@ done test -n "$obj_rejected" || exit 0 -obj_rejected="$(echo "$obj_rejected" | tr -s " " | sed -e "s/^ //" -e "s/ $//")" -echo "Couldn't verify objects: $obj_rejected" >&2 +obj_rejected="$(echo "$obj_rejected" | tr -s " " | + sed -e "s/^ //" -e "s/ $//")" +err "Couldn't verify objects: $obj_rejected" exit 1 ## Force signed pushes if receive.certNonceSeed is set. @@ -175,23 +180,23 @@ while read -r oldrev newrev ref; do obj_type="$(git cat-file -t "$newrev")" if test "$obj_type" = "tag"; then if git verify-tag "$newrev" >/dev/null 2>&1; then - true "Tag verification succeeded for tag: $newrev" + true "Tag validation succeeded for tag: $newrev" else obj_rejected="${obj_rejected-} $newrev " continue fi commit_tag="$(git rev-list -n1 "$newrev")" obj_rejected="$(echo "$obj_rejected" | sed "s/ $commit_tag //")" - echo "Commit verification done by tag: $commit_tag $newrev" >&2 + err "Commit validation done by tag: $commit_tag $newrev" continue fi for obj in $objects; do if git verify-commit "$obj" >/dev/null 2>&1; then - true "Commit verification succeeded commit: $obj" + true "Commit validation succeeded for commit: $obj" continue else - echo "No valid signature in commit: $obj" >&2 + err "No valid signature in commit: $obj" obj_rejected="${obj_rejected-} $obj " fi done @@ -199,6 +204,6 @@ done test -n "$obj_rejected" || exit 0 -obj_rejected="$(echo "$obj_rejected" | tr -s " " | sed -e "s/^ //" -e "s/ $//")" -echo "Couldn't verify objects: $obj_rejected" >&2 +obj_rejected="$(echo "$obj_rejected" | tr -s " " | sed -e "s/^ //;s/ $//")" +err "Couldn't verify objects: $obj_rejected" exit 1 diff --git a/files/git/.config/git/template/hooks/prepare-commit-msg b/files/git/.config/git/template/hooks/prepare-commit-msg index 173bec2..f639e57 100755 --- a/files/git/.config/git/template/hooks/prepare-commit-msg +++ b/files/git/.config/git/template/hooks/prepare-commit-msg @@ -25,8 +25,8 @@ fi ## Remove the default instructional message and its following empty line. sed -i'' \ - -e "/^. Please enter the commit message for your changes. Lines starting$/d" \ - -e "/^. with '.' will be ignored, and an empty message aborts the commit.$/ { + -e "/^. Please enter the commit message .*. Lines starting$/d" \ + -e "/^. with '.' will be ignored, .* aborts the commit.$/ { N; d; }" \ "$file" diff --git a/files/git/.local/bin/git-client-setup b/files/git/.local/bin/git-client-setup index 2be0bc0..ddcceba 100755 --- a/files/git/.local/bin/git-client-setup +++ b/files/git/.local/bin/git-client-setup @@ -43,5 +43,7 @@ else set_git_config format.signature "$user" fi -grep -E "^;*\s+(vim:.*(\s+|:)|vim:(\s*))(ft|filetype)=gitconfig((\s+|:).*|$)" \ - -q "$gitconfig_file" || sed -i'' "1i; $vim_modeline" "$gitconfig_file" +grep \ + -E "^;*\s+(vim:.*(\s+|:)|vim:(\s*))(ft|filetype)=gitconfig((\s+|:).*|$)" \ + -q "$gitconfig_file" || + sed -i'' "1i; $vim_modeline" "$gitconfig_file" diff --git a/files/git/.local/bin/git-server-setup b/files/git/.local/bin/git-server-setup index 3c9a587..f8d1e73 100755 --- a/files/git/.local/bin/git-server-setup +++ b/files/git/.local/bin/git-server-setup @@ -39,7 +39,9 @@ chmod -R 0755 "$git_home/git-shell-commands" git config --system receive.updateServerInfo true git config --system receive.advertisePushOptions true -nonce="$(head /dev/urandom | LC_ALL=C tr -dc 'A-Za-z0-9!#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | cut -c 1-256)" +nonce="$(head /dev/urandom | + LC_ALL=C tr -dc 'A-Za-z0-9!#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | + cut -c 1-256)" git config --system receive.certNonceSeed "$nonce" chown -R "$git_user":"$git_user" "$git_home" diff --git a/files/sh/.config/bash/bashrc b/files/sh/.config/bash/bashrc index f2b68c5..90f33ff 100644 --- a/files/sh/.config/bash/bashrc +++ b/files/sh/.config/bash/bashrc @@ -75,11 +75,18 @@ _save_ec() { _ec_ps1=$?; } PROMPT_COMMAND=(_save_ec) newline=$'\n' +# shellcheck disable=SC2154 if test "${color_prompt:-}" = "yes"; then # shellcheck disable=SC2154 - PS1="\$(_reset_line)\$(resize-terminal)\[\033[35m\][\[${reset_color}\]${debian_chroot:+($debian_chroot)}\[${usercolor}\]\u@\h \[${dircolor}\]\w\[${reset_color}\]\$(_git_prompt_info)\[\033[35m\]]\[${reset_color}\]${newline-}\$(_print_ec)${ps1_symbol} " + PS1="\$(_reset_line)\$(resize-terminal)\[\033[35m\][\[${reset_color}\]" + PS1="${PS1}${debian_chroot:+($debian_chroot)}\[${usercolor}\]\u@\h " + PS1="${PS1}\[${dircolor}\]\w\[${reset_color}\]\$(_git_prompt_info)" + PS1="${PS1}\[\033[35m\]]\[${reset_color}\]${newline-}\$(_print_ec)" + PS1="${PS1}${ps1_symbol} " else - PS1="\$(_reset_line)\$(resize-terminal)[${debian_chroot:+($debian_chroot)}\u@\h:\w\$(_git_prompt_info)]${newline-}\$(_print_ec)${ps1_symbol} " + PS1="\$(_reset_line)\$(resize-terminal)[${debian_chroot:+($debian_chroot)}" + PS1="${PS1}\u@\h:\w\$(_git_prompt_info)]${newline-}\$(_print_ec)" + PS1="${PS1}${ps1_symbol} " fi case "${TERM-}" in diff --git a/files/sh/.config/sh/profile b/files/sh/.config/sh/profile index 5acfe64..f19d4d4 100644 --- a/files/sh/.config/sh/profile +++ b/files/sh/.config/sh/profile @@ -7,7 +7,8 @@ ## Not so invasive because it only assigns a value if it is empty. : "${HOME:=$(cd ~ && pwd)}" : "${USER:=$(id -un || printf %s "${HOME##*/}")}" -: "${UID:=$(id -u || awk -F':' -v user="$USER" '/^user:/{print $3}' /etc/passwd)}" +: "${UID:=$(id -u || awk -F ":" -v user="$USER" '/^user:/{print $3}' \ + /etc/passwd)}" : "${HOSTNAME:=$(hostname)}" export HOME USER UID HOSTNAME @@ -17,7 +18,8 @@ XDG_CACHE_HOME="$HOME/.cache" XDG_DATA_HOME="$HOME/.local/share" XDG_STATE_HOME="$HOME/.local/state" export XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_HOME XDG_STATE_HOME -mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME" "$XDG_STATE_HOME" +mkdir -p \ + "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME" "$XDG_STATE_HOME" ## Set XDG_*_DIR variables. eval "$(grep "^[ ]*XDG_[A-Z].*_DIR=" "$XDG_CONFIG_HOME/user-dirs.dirs" | sed "s/^/export /")" diff --git a/files/sh/.config/sh/shrc b/files/sh/.config/sh/shrc index 2479b7d..5a753c1 100644 --- a/files/sh/.config/sh/shrc +++ b/files/sh/.config/sh/shrc @@ -122,7 +122,7 @@ has tmux && { ## {{{ Mutt if has mutt; then alias m="mutt" - alias mp="mutt -e 'unset signature' -e 'set pgp_autoinline=yes crypt_autosign=yes' -H" + alias mp="mutt -e 'set signature= pgp_autoinline=yes crypt_autosign=yes' -H" fi ## }}} ## {{{ Git @@ -183,7 +183,8 @@ if test "${color_prompt-}" = "yes"; then fi ## Set gcc colors. - GCC_COLORS="error=00;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01" + GCC_COLORS="error=00;31:warning=01;35:note=01;36:caret=01;32:locus=01" + GCC_COLORS="${GCC_COLORS}:quote=01" export GCC_COLORS ## Colors for programs that uses less such as 'man'. @@ -191,8 +192,8 @@ if test "${color_prompt-}" = "yes"; then LESS_TERMCAP_mb="$(tput bold; tput setaf 2)" # begin blink LESS_TERMCAP_md="$(tput bold; tput setaf 6)" # begin bold LESS_TERMCAP_me="$(tput sgr0)" # reset bold/blink - LESS_TERMCAP_so="$(tput bold; tput setaf 7; tput setab 4)" # begin reverse video - LESS_TERMCAP_se="$(tput rmso; tput sgr0)" # reset reverse video + LESS_TERMCAP_so="$(tput bold; tput setaf 7; tput setab 4)" # begin rev video + LESS_TERMCAP_se="$(tput rmso; tput sgr0)" # reset rev video LESS_TERMCAP_us="$(tput smul; tput bold; tput setaf 2)" # begin underline LESS_TERMCAP_ue="$(tput rmul; tput sgr0)" # reset underline LESS_TERMCAP_mr="$(tput rev)" # revert @@ -219,7 +220,8 @@ _git_prompt_info(){ git -v >/dev/null 2>&1 || return fi ref="$(git symbolic-ref HEAD 2>/dev/null | cut -d '/' -f3)" - test "${ref-}" || ref="$(git describe --tags --exact-match HEAD 2>/dev/null)" + test "${ref-}" || + ref="$(git describe --tags --exact-match HEAD 2>/dev/null)" test "${ref-}" || ref="$(git rev-parse HEAD 2>/dev/null | cut -c 1-7)" test "${ref-}" || return # shellcheck disable=2039,3003 @@ -242,6 +244,7 @@ _git_prompt_info(){ printf '%s' "($ref)" fi fi + unset ref } # shellcheck disable=SC2034 diff --git a/files/sh/.config/zsh/.zshrc b/files/sh/.config/zsh/.zshrc index 3b3bea3..646d18f 100644 --- a/files/sh/.config/zsh/.zshrc +++ b/files/sh/.config/zsh/.zshrc @@ -72,12 +72,16 @@ alias reload="exec zsh" newline=$'\n' if test "${color_prompt-}" = "yes"; then autoload -U colors && colors - [[ "${COLORTERM-}" == (24bit|truecolor) || "${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor + [[ "${COLORTERM-}" == (24bit|truecolor) || + "${terminfo[colors]}" -eq '16777216' ]] || zmodload zsh/nearcolor - PS1="\$(resize-terminal)%F{magenta}[%{$usercolor%}%n@%m%F{reset_color%} %{$dircolor%}%50<...<%~%<<%F{reset_color%}\$(_git_prompt_info)%F{magenta}]%F{reset_color}${newline-}${ps1_symbol} " + PS1="\$(resize-terminal)%F{magenta}[%{$usercolor%}%n@%m%F{reset_color%}" + PS1="${PS1} %{$dircolor%}%50<...<%~%<<%F{reset_color%}\$(_git_prompt_info)" + PS1="${PS1}%F{magenta}]%F{reset_color}${newline-}${ps1_symbol} " RPS1="%(?..(%{"$'\e[31m'"%}%?%{$reset_color%}%)%<<)" else - PS1="\$(resize-terminal)[%n@%M %~\$(_git_prompt_info)]${newline}${ps1_symbol} " + PS1="\$(resize-terminal)[%n@%M %~\$(_git_prompt_info)]${newline}" + PS1="${PS1}${ps1_symbol} " RPS1="%(?..(%?%)%<<)" fi @@ -138,7 +142,8 @@ unset newline ## Enable completion. zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}"/zsh/zcompcache +zstyle ':completion:*' cache-path \ + "${XDG_CACHE_HOME:-$HOME/.cache}"/zsh/zcompcache zstyle ':completion:*' auto-description 'Specify: %d' zstyle ':completion:*' completer _expand _complete _ignored _approximate zstyle ':completion:*' expand prefix suffix @@ -146,13 +151,17 @@ zstyle ':completion:*' file-sort name zstyle ':completion:*' group-name '' zstyle ':completion:*' ignore-parents parent pwd .. zstyle ':completion:*' insert-unambiguous true -zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' list-prompt \ + %SAt %p: Hit TAB for more, or the character to insert%s zstyle ':completion:*' list-suffixes true -zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' +zstyle ':completion:*' matcher-list '' \ + 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' \ + 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' zstyle ':completion:*' menu select=1 zstyle ':completion:*' original true zstyle ':completion:*' preserve-prefix '//[^/]##/' -zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' select-prompt \ + %SScrolling active: current selection at %p%s zstyle ':completion:*' special-dirs true zstyle ':completion:*' squeeze-slashes true zstyle ':completion:*' use-compctl true @@ -185,14 +194,15 @@ zstyle ':completion:*:doas::' environ \ if test "${color_prompt-}" = "yes"; then zstyle ':completion:*:*:*:*:descriptions' format '%B%F{blue}-- %d --%b%f' zstyle ':completion:*:messages' format ' %B%F{purple} -- %d --%f%b' - zstyle ':completion:*:warnings' format ' %B%F{red}-- no matches found --%f%b' + zstyle ':completion:*:warnings' format ' %B%F{red}-- no matches --%f%b' zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} - zstyle ':completion:*:*:kill:*' list-colors '=(#b) #([0-9]#)*( *[a-z])*=94=91=93' + zstyle ':completion:*:*:kill:*' list-colors \ + '=(#b) #([0-9]#)*( *[a-z])*=94=91=93' else zstyle ':completion:*:*:*:*:descriptions' format '-- %d --%b%f' zstyle ':completion:*:messages' format ' -- %d --%f%b' - zstyle ':completion:*:warnings' format ' -- no matches found --%f%b' + zstyle ':completion:*:warnings' format ' -- no matches --%f%b' zstyle ':completion:*:default' list-colors '' zstyle ':completion:*:*:kill:*' list-colors '' @@ -221,7 +231,8 @@ if test "${color_prompt-}" = "yes"; then source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh fi ## Highlight commands as you type - if test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; then + if test -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + then ## https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern regexp) typeset -A ZSH_HIGHLIGHT_STYLES @@ -423,7 +434,8 @@ bindkey-multi emacs viins vicmd -- "\E[1~" "\E[7~" "\E[H" "\EOH" \ bindkey-multi emacs viins vicmd -- "\E[2~" "\E[L" "${terminfo[kich1]}" \ -- overwrite-mode ## Delete -bindkey-multi emacs viins vicmd -- "\E[3~" "\E[P" "\EOP" "${terminfo[kdch1]}" \ +bindkey-multi emacs viins vicmd -- "\E[3~" "\E[P" "\EOP" \ + "${terminfo[kdch1]}" \ -- vi-delete-char ## End bindkey-multi emacs viins vicmd -- "\E[4~" "\E[8~" "\E[F" "\EOF" \ @@ -442,7 +454,8 @@ bindkey-multi emacs viins vicmd -- "\E[A" "\EOA" "${terminfo[kcuu1]}" \ bindkey-multi emacs viins vicmd -- "\E[B" "\EOB" "${terminfo[kcud1]}" \ -- down-line-or-history ## Right arrow -bindkey-multi emacs viins vicmd -- "\E[1C" "\E[C" "\EOC" "${terminfo[kcuf1]}" \ +bindkey-multi emacs viins vicmd -- "\E[1C" "\E[C" "\EOC" \ + "${terminfo[kcuf1]}" \ -- forward-char ## Left arrow bindkey-multi emacs viins vicmd -- "\E[D" "\EOD" "${terminfo[kcub1]}" \ diff --git a/files/sh/.local/bin/resize-terminal b/files/sh/.local/bin/resize-terminal index 07aceed..ded470e 100755 --- a/files/sh/.local/bin/resize-terminal +++ b/files/sh/.local/bin/resize-terminal @@ -20,7 +20,9 @@ if test "${#}" -eq 0; then term_file_wanted="ttyUSB ttyS" ## Consoles are desired. if test -r /sys/class/tty/console/active; then - term_file_wanted="${term_file_wanted} $(cat /sys/class/tty/console/active)" + active_console="$(cat /sys/class/tty/console/active)" + term_file_wanted="${term_file_wanted} ${active_console}" + unset active_console fi term_file_active=0 for tf in $(printf %s"${term_file_wanted}"); do diff --git a/files/tmux/.local/bin/ta b/files/tmux/.local/bin/ta index 8536f72..e9d83e3 100755 --- a/files/tmux/.local/bin/ta +++ b/files/tmux/.local/bin/ta @@ -37,7 +37,8 @@ ta_new(){ main(){ if test -n "$TMUX"; then ## Inside tmux. - if test -n "$ta_session" && tmux has-session -t "$ta_session" >/dev/null 2>&1; then + if test "$ta_session" && tmux has-session -t "$ta_session" >/dev/null 2>&1 + then ## Session name was specified and it exists. tmux switch-client -t "$ta_session" tmux display-message "Switched to session $ta_session" @@ -93,7 +94,8 @@ main(){ return 0 fi - if test -n "$ta_session" && tmux has-session -t "$ta_session" >/dev/null 2>&1; then + if test "$ta_session" && tmux has-session -t "$ta_session" >/dev/null 2>&1 + then ## Session name was specified and it exists. tmux attach-session -t "$ta_session" tmux display-message "Attached to session $ta_session"