style: Normalize variable expansions to ${var} across the repo
Replace bare $var with ${var} everywhere it was still used, matching
the convention already established in rc.d/prompt and rc.d/history.
Positional parameters ($1, $@, $#) and special variables ($?, $$, $-)
are left as-is, consistent with existing usage in _helpers.bash.
rc.d/broot is auto-generated by the broot binary and will likely be
overwritten with its original formatting on the next broot update.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
# https://github.com/riywo/anyenv
|
||||
|
||||
# git clone https://github.com/riywo/anyenv $HOME/.anyenv
|
||||
# git clone https://github.com/riywo/anyenv ${HOME}/.anyenv
|
||||
|
||||
if (which anyenv &>/dev/null); then
|
||||
eval "$(anyenv init -)"
|
||||
|
||||
@@ -8,7 +8,7 @@ if [ -f ~/.asdf/asdf.sh ]; then
|
||||
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.nix-profile/share/asdf-vm/asdf.sh" ]; then
|
||||
. "$HOME/.nix-profile/share/asdf-vm/asdf.sh"
|
||||
. "$HOME/.nix-profile/share/bash-completion/completions/asdf.bash"
|
||||
if [ -f "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" ]; then
|
||||
. "${HOME}/.nix-profile/share/asdf-vm/asdf.sh"
|
||||
. "${HOME}/.nix-profile/share/bash-completion/completions/asdf.bash"
|
||||
fi
|
||||
|
||||
+6
-6
@@ -8,14 +8,14 @@ if (command -v broot &>/dev/null); then
|
||||
function br {
|
||||
local cmd cmd_file code
|
||||
cmd_file=$(mktemp)
|
||||
if broot --outcmd "$cmd_file" "$@"; then
|
||||
cmd=$(<"$cmd_file")
|
||||
rm -f "$cmd_file"
|
||||
eval "$cmd"
|
||||
if broot --outcmd "${cmd_file}" "$@"; then
|
||||
cmd=$(<"${cmd_file}")
|
||||
rm -f "${cmd_file}"
|
||||
eval "${cmd}"
|
||||
else
|
||||
code=$?
|
||||
rm -f "$cmd_file"
|
||||
return "$code"
|
||||
rm -f "${cmd_file}"
|
||||
return "${code}"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
# Use cgroups
|
||||
if [ "$PS1" ] ; then
|
||||
if [ "${PS1}" ] ; then
|
||||
|
||||
if [ -d /sys/fs/cgroup ] ; then
|
||||
cdir=/sys/fs/cgroup
|
||||
@@ -7,10 +7,10 @@ if [ "$PS1" ] ; then
|
||||
cdir=/dev/cgroup
|
||||
fi
|
||||
|
||||
if [ -d "$cdir/user" ]; then
|
||||
mkdir -p -m 0700 $cdir/user/$$ > /dev/null 2>&1
|
||||
/bin/echo $$ > $cdir/user/$$/tasks
|
||||
/bin/echo '1' > $cdir/user/$$/notify_on_release
|
||||
if [ -d "${cdir}/user" ]; then
|
||||
mkdir -p -m 0700 "${cdir}/user/$$" > /dev/null 2>&1
|
||||
/bin/echo $$ > "${cdir}/user/$$/tasks"
|
||||
/bin/echo '1' > "${cdir}/user/$$/notify_on_release"
|
||||
unset -v cdir
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Load RVM into a shell session *as a function*
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
|
||||
[[ -s "${HOME}/.rvm/scripts/rvm" ]] && source "${HOME}/.rvm/scripts/rvm"
|
||||
|
||||
# Source bash completion for RVM
|
||||
[[ -r "$HOME/.rvm/scripts/completion" ]] && source "$HOME/.rvm/scripts/completion"
|
||||
[[ -r "${HOME}/.rvm/scripts/completion" ]] && source "${HOME}/.rvm/scripts/completion"
|
||||
|
||||
# Add RVM to PATH for scripting
|
||||
[[ -r "$HOME/.rvm/bin" ]] && PATH=$PATH:$HOME/.rvm/bin
|
||||
[[ -r "${HOME}/.rvm/bin" ]] && PATH="${PATH}:${HOME}/.rvm/bin"
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
# GNU Screen stuff
|
||||
if ( which screen &> /dev/null )
|
||||
then
|
||||
if [[ $TERM != screen* ]]
|
||||
if [[ ${TERM} != screen* ]]
|
||||
then
|
||||
if [ "$(screen -ls | sed -ne 's/[[:space:]]//' -ne 's/(Attached)// p')" ]
|
||||
then
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
# Auto startx depending on the VT
|
||||
|
||||
if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then
|
||||
if [[ -z "${DISPLAY}" && $(id -u) -ge 1000 ]] ; then
|
||||
|
||||
TTY=$(tty)
|
||||
if [ "$TTY" == "not a tty" ]; then return; fi
|
||||
if [ "${TTY/tty}" != "$TTY" -a $(basename ${TTY/tty}) -le 3 ]
|
||||
if [ "${TTY}" == "not a tty" ]; then return; fi
|
||||
if [ "${TTY/tty}" != "${TTY}" -a "$(basename "${TTY/tty}")" -le 3 ]
|
||||
then
|
||||
|
||||
case $(tty | cut -b9-) in
|
||||
@@ -20,7 +20,7 @@ if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then
|
||||
|
||||
if ( which startx &> /dev/null )
|
||||
then
|
||||
$EXEC startx 1> ~/.log/xsession-errors 2>&1 -- $VT
|
||||
${EXEC} startx 1> ~/.log/xsession-errors 2>&1 -- "${VT}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
+5
-5
@@ -6,14 +6,14 @@ _update_terminal_title() {
|
||||
if [ -n "${KUBECONFIG}" ]; then
|
||||
if command -v kubectl >/dev/null 2>&1; then
|
||||
kubecontext=$(kubectl config current-context 2>/dev/null)
|
||||
if [ -n "$kubecontext" ]; then
|
||||
if [ -n "${kubecontext}" ]; then
|
||||
title=" ${kubecontext}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If no title is already set, check if we're in $HOME
|
||||
if [ -z "${title}" ] && [ "$PWD" = "$HOME" ]; then
|
||||
# If no title is already set, check if we're in ${HOME}
|
||||
if [ -z "${title}" ] && [ "${PWD}" = "${HOME}" ]; then
|
||||
title=" ~"
|
||||
fi
|
||||
|
||||
@@ -35,7 +35,7 @@ _update_terminal_title() {
|
||||
|
||||
# Set the title in tmux or terminal window
|
||||
if [ -n "${title}" ]; then
|
||||
if [ -n "$TMUX" ]; then
|
||||
if [ -n "${TMUX}" ]; then
|
||||
tmux rename-window "${title}"
|
||||
else
|
||||
printf '\033]0;%s\007' "${title}"
|
||||
@@ -44,4 +44,4 @@ _update_terminal_title() {
|
||||
}
|
||||
|
||||
# Add the function to the PROMPT_COMMAND variable to have regular updates
|
||||
if [ "$TERM" != "linux" ]; then _prompt_command_add "_update_terminal_title"; fi
|
||||
if [ "${TERM}" != "linux" ]; then _prompt_command_add "_update_terminal_title"; fi
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# GNU Screen stuff
|
||||
if (command -v tmux &>/dev/null); then
|
||||
if [ "$(pgrep -u "$UID" "tmux" | wc -l)" -gt 0 ]; then
|
||||
if [[ $TERM != screen* ]]; then
|
||||
if [ "$(pgrep -u "${UID}" "tmux" | wc -l)" -gt 0 ]; then
|
||||
if [[ ${TERM} != screen* ]]; then
|
||||
nb_sessions=$(tmux list-session | wc -l)
|
||||
nb_sessions_attached=$(tmux list-session | grep -c "attached")
|
||||
nb_sessions_detached=$(tmux list-session | grep -c -v "attached")
|
||||
|
||||
+3
-3
@@ -6,16 +6,16 @@
|
||||
## Quick functions
|
||||
#
|
||||
#zp() {
|
||||
# URXVT_FONT_SIZE=$(echo "$URXVT_FONT_SIZE+$URXVT_FONT_INCREMENT" | bc )
|
||||
# URXVT_FONT_SIZE=$(echo "${URXVT_FONT_SIZE}+${URXVT_FONT_INCREMENT}" | bc )
|
||||
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
||||
#}
|
||||
#
|
||||
#zm() {
|
||||
# URXVT_FONT_SIZE=$(echo "$URXVT_FONT_SIZE-$URXVT_FONT_INCREMENT" | bc )
|
||||
# URXVT_FONT_SIZE=$(echo "${URXVT_FONT_SIZE}-${URXVT_FONT_INCREMENT}" | bc )
|
||||
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
||||
#}
|
||||
#
|
||||
#if [ -z "$SSH_CONNECTION" ]
|
||||
#if [ -z "${SSH_CONNECTION}" ]
|
||||
#then
|
||||
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
||||
#fi
|
||||
|
||||
Reference in New Issue
Block a user