Normalisation et nettoyage #4
+9
-9
@@ -4,22 +4,22 @@ function basedir() {
|
|||||||
|
|
||||||
function _source_file_if_exists() {
|
function _source_file_if_exists() {
|
||||||
if [ -r "$1" ]; then
|
if [ -r "$1" ]; then
|
||||||
test -n "$DEBUG_BASHRC" && echo "-- Sourcing file $1"
|
test -n "${DEBUG_BASHRC}" && echo "-- Sourcing file $1"
|
||||||
source "$1"
|
source "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _source_dir_files() {
|
function _source_dir_files() {
|
||||||
if [ -d "$1" ]; then
|
if [ -d "$1" ]; then
|
||||||
test -n "$DEBUG_BASHRC" && echo "-- Sourcing files in directory $1"
|
test -n "${DEBUG_BASHRC}" && echo "-- Sourcing files in directory $1"
|
||||||
|
|
||||||
# Safe loops for empty dirs
|
# Safe loops for empty dirs
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
for file in "$1"/*; do
|
for file in "$1"/*; do
|
||||||
if [ -e "$file" ]; then
|
if [ -e "${file}" ]; then
|
||||||
test -n "$DEBUG_BASHRC" && echo " * sourcing file $file"
|
test -n "${DEBUG_BASHRC}" && echo " * sourcing file ${file}"
|
||||||
source "$file"
|
source "${file}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -30,13 +30,13 @@ function _source_dir_files() {
|
|||||||
|
|
||||||
# Source : https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
# Source : https://superuser.com/questions/39751/add-directory-to-path-if-its-not-already-there
|
||||||
_path_add() {
|
_path_add() {
|
||||||
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
|
if [ -d "$1" ] && [[ ":${PATH}:" != *":$1:"* ]]; then
|
||||||
PATH="${PATH:+"$PATH:"}$1"
|
PATH="${PATH:+"${PATH}:"}$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_prompt_command_add() {
|
_prompt_command_add() {
|
||||||
if [ -n "$1" ] && [[ ":$PROMPT_COMMAND:" != *":$1:"* ]]; then
|
if [ -n "$1" ] && [[ ":${PROMPT_COMMAND}:" != *":$1:"* ]]; then
|
||||||
PROMPT_COMMAND="${PROMPT_COMMAND:+"$PROMPT_COMMAND;"}$1"
|
PROMPT_COMMAND="${PROMPT_COMMAND:+"${PROMPT_COMMAND};"}$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# Fun
|
# Fun
|
||||||
alias matrix='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"'
|
alias matrix='tr -c "[:digit:]" " " < /dev/urandom | dd cbs=${COLUMNS} conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"'
|
||||||
|
|
||||||
if (command -v beep &> /dev/null)
|
if (command -v beep &> /dev/null)
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
if [ -f /etc/gentoo-release -a "$UID" -ne 0 ]
|
if [ -f /etc/gentoo-release -a "${UID}" -ne 0 ]
|
||||||
then
|
then
|
||||||
alias emerge='sudo emerge'
|
alias emerge='sudo emerge'
|
||||||
alias etc-update='sudo etc-update'
|
alias etc-update='sudo etc-update'
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
if (which mc &> /dev/null); then
|
if (which mc &> /dev/null); then
|
||||||
if [ "$TERM" = "rxvt-unicode" ]; then
|
if [ "${TERM}" = "rxvt-unicode" ]; then
|
||||||
alias mc="TERM=rxvt-unicode-256color mc"
|
alias mc="TERM=rxvt-unicode-256color mc"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ _source_dir_files "${BASH_CONFIG_DIR}"/aliases.d
|
|||||||
|
|
||||||
# Source bash completion definitions
|
# Source bash completion definitions
|
||||||
# TODO: Améliorer cette partie pour éviter les erreurs quand aucun fichier n'existe
|
# TODO: Améliorer cette partie pour éviter les erreurs quand aucun fichier n'existe
|
||||||
for file in /etc/bash*completion /etc/profile.d/bash*completion*; do source "$file"; done
|
for file in /etc/bash*completion /etc/profile.d/bash*completion*; do source "${file}"; done
|
||||||
|
|
||||||
_source_file_if_exists ~/.bash_completion
|
_source_file_if_exists ~/.bash_completion
|
||||||
_source_file_if_exists "${BASH_CONFIG_DIR}"/completion
|
_source_file_if_exists "${BASH_CONFIG_DIR}"/completion
|
||||||
@@ -89,7 +89,7 @@ _source_dir_files "${BASH_CONFIG_DIR}"/completion.d
|
|||||||
_source_dir_files ~/.nix-profile/share/bash-completion/completions
|
_source_dir_files ~/.nix-profile/share/bash-completion/completions
|
||||||
|
|
||||||
if (command -v _complete_alias &>/dev/null); then
|
if (command -v _complete_alias &>/dev/null); then
|
||||||
for alias in $(alias -p | awk '{print $2}' | awk -F= '{print $1}'); do complete -o default -F _complete_alias "$alias"; done
|
for alias in $(alias -p | awk '{print $2}' | awk -F= '{print $1}'); do complete -o default -F _complete_alias "${alias}"; done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Late customization
|
# Late customization
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ function devenv() {
|
|||||||
if [ "${status}" != "RUNNING" ]; then lxc start devenv; fi
|
if [ "${status}" != "RUNNING" ]; then lxc start devenv; fi
|
||||||
|
|
||||||
# Rename tmux window if inside tmux
|
# Rename tmux window if inside tmux
|
||||||
if [ -n "$TMUX" ]; then tmux rename-window "devenv"; fi
|
if [ -n "${TMUX}" ]; then tmux rename-window "devenv"; fi
|
||||||
|
|
||||||
# Login as user xavier
|
# Login as user xavier
|
||||||
lxc exec devenv -- login -f xavier
|
lxc exec devenv -- login -f xavier
|
||||||
|
|||||||
+5
-5
@@ -1,17 +1,17 @@
|
|||||||
note() {
|
note() {
|
||||||
# if file doesn't exist, create it
|
# if file doesn't exist, create it
|
||||||
if [[ ! -f $HOME/.notes ]]; then
|
if [[ ! -f "${HOME}/.notes" ]]; then
|
||||||
touch "$HOME"/.notes
|
touch "${HOME}"/.notes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
# no arguments, print file
|
# no arguments, print file
|
||||||
cat "$HOME"/.notes
|
cat "${HOME}"/.notes
|
||||||
elif [[ "$1" == "-c" ]]; then
|
elif [[ "$1" == "-c" ]]; then
|
||||||
# clear file
|
# clear file
|
||||||
echo "" >"$HOME"/.notes
|
echo "" >"${HOME}"/.notes
|
||||||
else
|
else
|
||||||
# add all arguments to file
|
# add all arguments to file
|
||||||
echo "$@" >>"$HOME"/.notes
|
echo "$@" >>"${HOME}"/.notes
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -1,21 +1,21 @@
|
|||||||
encpasswd() {
|
encpasswd() {
|
||||||
local password_clear=$1
|
local password_clear=$1
|
||||||
local password_md5hash=$(openssl passwd -1 "$password_clear")
|
local password_md5hash=$(openssl passwd -1 "${password_clear}")
|
||||||
local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1)
|
local password_sha1=$(echo -n "${password_clear}" | openssl dgst -sha1)
|
||||||
echo "Password : $password_clear"
|
echo "Password : ${password_clear}"
|
||||||
echo "MD5HASH : $password_md5hash"
|
echo "MD5HASH : ${password_md5hash}"
|
||||||
echo "SHA1 : $password_sha1"
|
echo "SHA1 : ${password_sha1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
genpasswd() {
|
genpasswd() {
|
||||||
local l=$1
|
local l=$1
|
||||||
[ "$l" == "" ] && l=12
|
[ "${l}" == "" ] && l=12
|
||||||
local password_clear=$(tr -dc A-Za-z0-9_ </dev/urandom | head -c "${l}" | xargs)
|
local password_clear=$(tr -dc A-Za-z0-9_ </dev/urandom | head -c "${l}" | xargs)
|
||||||
local password_md5hash=$(openssl passwd -1 "$password_clear")
|
local password_md5hash=$(openssl passwd -1 "${password_clear}")
|
||||||
local password_sha1=$(echo -n "$password_clear" | openssl dgst -sha1)
|
local password_sha1=$(echo -n "${password_clear}" | openssl dgst -sha1)
|
||||||
local password_base64=$(echo -n "$password_clear" | base64)
|
local password_base64=$(echo -n "${password_clear}" | base64)
|
||||||
echo "Password : $password_clear"
|
echo "Password : ${password_clear}"
|
||||||
echo "Base64 : $password_base64"
|
echo "Base64 : ${password_base64}"
|
||||||
echo "MD5HASH : $password_md5hash"
|
echo "MD5HASH : ${password_md5hash}"
|
||||||
echo "SHA1 : $password_sha1"
|
echo "SHA1 : ${password_sha1}"
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
function term_change_title {
|
function term_change_title {
|
||||||
case $TERM in
|
case ${TERM} in
|
||||||
# Change the window title of X terminals
|
# Change the window title of X terminals
|
||||||
xterm* | rxvt* | urxvt* | Eterm)
|
xterm* | rxvt* | urxvt* | Eterm)
|
||||||
echo -ne "\033]0;${1}\007"
|
echo -ne "\033]0;${1}\007"
|
||||||
|
|||||||
+8
-8
@@ -1,20 +1,20 @@
|
|||||||
todo() {
|
todo() {
|
||||||
if [[ ! -f $HOME/.todo ]]; then
|
if [[ ! -f "${HOME}/.todo" ]]; then
|
||||||
touch $HOME/.todo
|
touch "${HOME}/.todo"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
cat $HOME/.todo
|
cat "${HOME}/.todo"
|
||||||
elif [[ "$1" == "-l" ]]; then
|
elif [[ "$1" == "-l" ]]; then
|
||||||
cat -n $HOME/.todo
|
cat -n "${HOME}/.todo"
|
||||||
elif [[ "$1" == "-c" ]]; then
|
elif [[ "$1" == "-c" ]]; then
|
||||||
echo "" > $HOME/.todo
|
echo "" > "${HOME}/.todo"
|
||||||
elif [[ "$1" == "-r" ]]; then
|
elif [[ "$1" == "-r" ]]; then
|
||||||
cat -n $HOME/.todo
|
cat -n "${HOME}/.todo"
|
||||||
echo -ne "----------------------------\nType a number to remove: "
|
echo -ne "----------------------------\nType a number to remove: "
|
||||||
read NUMBER
|
read NUMBER
|
||||||
sed -ie ${NUMBER}d $HOME/.todo
|
sed -ie "${NUMBER}d" "${HOME}/.todo"
|
||||||
else
|
else
|
||||||
echo "$@" >> $HOME/.todo
|
echo "$@" >> "${HOME}/.todo"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
# https://github.com/riywo/anyenv
|
# https://github.com/riywo/anyenv
|
||||||
|
|
||||||
# git clone https://github.com/riywo/anyenv $HOME/.anyenv
|
# git clone https://github.com/riywo/anyenv ${HOME}/.anyenv
|
||||||
|
|
||||||
if [ -d "$HOME/.anyenv/bin" ]
|
if [ -d "${HOME}/.anyenv/bin" ]
|
||||||
then
|
then
|
||||||
export PATH="$HOME/.anyenv/bin:$PATH"
|
export PATH="${HOME}/.anyenv/bin:${PATH}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
if (command -v krew &>/dev/null); then
|
if (command -v krew &>/dev/null); then
|
||||||
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
|
export PATH="${KREW_ROOT:-${HOME}/.krew}/bin:${PATH}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
# Customize PATH
|
# Customize PATH
|
||||||
if [ -d $HOME/.bin ] ; then export PATH=$PATH:$HOME/.bin ; fi
|
if [ -d "${HOME}/.bin" ] ; then export PATH="${PATH}:${HOME}/.bin" ; fi
|
||||||
if [ -d $HOME/.local/bin ] ; then export PATH=$PATH:$HOME/.local/bin ; fi
|
if [ -d "${HOME}/.local/bin" ] ; then export PATH="${PATH}:${HOME}/.local/bin" ; fi
|
||||||
|
|
||||||
if [ -d $HOME/bin ] ; then export PATH=$PATH:$HOME/bin ; fi
|
if [ -d "${HOME}/bin" ] ; then export PATH="${PATH}:${HOME}/bin" ; fi
|
||||||
if [ -d $HOME/scripts ] ; then export PATH=$PATH:$HOME/scripts ; fi
|
if [ -d "${HOME}/scripts" ] ; then export PATH="${PATH}:${HOME}/scripts" ; fi
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# https://github.com/riywo/anyenv
|
# 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
|
if (which anyenv &>/dev/null); then
|
||||||
eval "$(anyenv init -)"
|
eval "$(anyenv init -)"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ if [ -f ~/.asdf/asdf.sh ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$HOME/.nix-profile/share/asdf-vm/asdf.sh" ]; then
|
if [ -f "${HOME}/.nix-profile/share/asdf-vm/asdf.sh" ]; then
|
||||||
. "$HOME/.nix-profile/share/asdf-vm/asdf.sh"
|
. "${HOME}/.nix-profile/share/asdf-vm/asdf.sh"
|
||||||
. "$HOME/.nix-profile/share/bash-completion/completions/asdf.bash"
|
. "${HOME}/.nix-profile/share/bash-completion/completions/asdf.bash"
|
||||||
fi
|
fi
|
||||||
|
|||||||
+6
-6
@@ -8,14 +8,14 @@ if (command -v broot &>/dev/null); then
|
|||||||
function br {
|
function br {
|
||||||
local cmd cmd_file code
|
local cmd cmd_file code
|
||||||
cmd_file=$(mktemp)
|
cmd_file=$(mktemp)
|
||||||
if broot --outcmd "$cmd_file" "$@"; then
|
if broot --outcmd "${cmd_file}" "$@"; then
|
||||||
cmd=$(<"$cmd_file")
|
cmd=$(<"${cmd_file}")
|
||||||
rm -f "$cmd_file"
|
rm -f "${cmd_file}"
|
||||||
eval "$cmd"
|
eval "${cmd}"
|
||||||
else
|
else
|
||||||
code=$?
|
code=$?
|
||||||
rm -f "$cmd_file"
|
rm -f "${cmd_file}"
|
||||||
return "$code"
|
return "${code}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|||||||
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
# Use cgroups
|
# Use cgroups
|
||||||
if [ "$PS1" ] ; then
|
if [ "${PS1}" ] ; then
|
||||||
|
|
||||||
if [ -d /sys/fs/cgroup ] ; then
|
if [ -d /sys/fs/cgroup ] ; then
|
||||||
cdir=/sys/fs/cgroup
|
cdir=/sys/fs/cgroup
|
||||||
@@ -7,10 +7,10 @@ if [ "$PS1" ] ; then
|
|||||||
cdir=/dev/cgroup
|
cdir=/dev/cgroup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$cdir/user" ]; then
|
if [ -d "${cdir}/user" ]; then
|
||||||
mkdir -p -m 0700 $cdir/user/$$ > /dev/null 2>&1
|
mkdir -p -m 0700 "${cdir}/user/$$" > /dev/null 2>&1
|
||||||
/bin/echo $$ > $cdir/user/$$/tasks
|
/bin/echo $$ > "${cdir}/user/$$/tasks"
|
||||||
/bin/echo '1' > $cdir/user/$$/notify_on_release
|
/bin/echo '1' > "${cdir}/user/$$/notify_on_release"
|
||||||
unset -v cdir
|
unset -v cdir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Load RVM into a shell session *as a function*
|
# 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
|
# 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
|
# 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
|
# GNU Screen stuff
|
||||||
if ( which screen &> /dev/null )
|
if ( which screen &> /dev/null )
|
||||||
then
|
then
|
||||||
if [[ $TERM != screen* ]]
|
if [[ ${TERM} != screen* ]]
|
||||||
then
|
then
|
||||||
if [ "$(screen -ls | sed -ne 's/[[:space:]]//' -ne 's/(Attached)// p')" ]
|
if [ "$(screen -ls | sed -ne 's/[[:space:]]//' -ne 's/(Attached)// p')" ]
|
||||||
then
|
then
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
# Auto startx depending on the VT
|
# Auto startx depending on the VT
|
||||||
|
|
||||||
if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then
|
if [[ -z "${DISPLAY}" && $(id -u) -ge 1000 ]] ; then
|
||||||
|
|
||||||
TTY=$(tty)
|
TTY=$(tty)
|
||||||
if [ "$TTY" == "not a tty" ]; then return; fi
|
if [ "${TTY}" == "not a tty" ]; then return; fi
|
||||||
if [ "${TTY/tty}" != "$TTY" -a $(basename ${TTY/tty}) -le 3 ]
|
if [ "${TTY/tty}" != "${TTY}" -a "$(basename "${TTY/tty}")" -le 3 ]
|
||||||
then
|
then
|
||||||
|
|
||||||
case $(tty | cut -b9-) in
|
case $(tty | cut -b9-) in
|
||||||
@@ -20,7 +20,7 @@ if [[ -z "$DISPLAY" && $(id -u) -ge 1000 ]] ; then
|
|||||||
|
|
||||||
if ( which startx &> /dev/null )
|
if ( which startx &> /dev/null )
|
||||||
then
|
then
|
||||||
$EXEC startx 1> ~/.log/xsession-errors 2>&1 -- $VT
|
${EXEC} startx 1> ~/.log/xsession-errors 2>&1 -- "${VT}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
+5
-5
@@ -6,14 +6,14 @@ _update_terminal_title() {
|
|||||||
if [ -n "${KUBECONFIG}" ]; then
|
if [ -n "${KUBECONFIG}" ]; then
|
||||||
if command -v kubectl >/dev/null 2>&1; then
|
if command -v kubectl >/dev/null 2>&1; then
|
||||||
kubecontext=$(kubectl config current-context 2>/dev/null)
|
kubecontext=$(kubectl config current-context 2>/dev/null)
|
||||||
if [ -n "$kubecontext" ]; then
|
if [ -n "${kubecontext}" ]; then
|
||||||
title=" ${kubecontext}"
|
title=" ${kubecontext}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If no title is already set, check if we're in $HOME
|
# If no title is already set, check if we're in ${HOME}
|
||||||
if [ -z "${title}" ] && [ "$PWD" = "$HOME" ]; then
|
if [ -z "${title}" ] && [ "${PWD}" = "${HOME}" ]; then
|
||||||
title=" ~"
|
title=" ~"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ _update_terminal_title() {
|
|||||||
|
|
||||||
# Set the title in tmux or terminal window
|
# Set the title in tmux or terminal window
|
||||||
if [ -n "${title}" ]; then
|
if [ -n "${title}" ]; then
|
||||||
if [ -n "$TMUX" ]; then
|
if [ -n "${TMUX}" ]; then
|
||||||
tmux rename-window "${title}"
|
tmux rename-window "${title}"
|
||||||
else
|
else
|
||||||
printf '\033]0;%s\007' "${title}"
|
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
|
# 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
|
# GNU Screen stuff
|
||||||
if (command -v tmux &>/dev/null); then
|
if (command -v tmux &>/dev/null); then
|
||||||
if [ "$(pgrep -u "$UID" "tmux" | wc -l)" -gt 0 ]; then
|
if [ "$(pgrep -u "${UID}" "tmux" | wc -l)" -gt 0 ]; then
|
||||||
if [[ $TERM != screen* ]]; then
|
if [[ ${TERM} != screen* ]]; then
|
||||||
nb_sessions=$(tmux list-session | wc -l)
|
nb_sessions=$(tmux list-session | wc -l)
|
||||||
nb_sessions_attached=$(tmux list-session | grep -c "attached")
|
nb_sessions_attached=$(tmux list-session | grep -c "attached")
|
||||||
nb_sessions_detached=$(tmux list-session | grep -c -v "attached")
|
nb_sessions_detached=$(tmux list-session | grep -c -v "attached")
|
||||||
|
|||||||
+3
-3
@@ -6,16 +6,16 @@
|
|||||||
## Quick functions
|
## Quick functions
|
||||||
#
|
#
|
||||||
#zp() {
|
#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}"
|
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
||||||
#}
|
#}
|
||||||
#
|
#
|
||||||
#zm() {
|
#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}"
|
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
||||||
#}
|
#}
|
||||||
#
|
#
|
||||||
#if [ -z "$SSH_CONNECTION" ]
|
#if [ -z "${SSH_CONNECTION}" ]
|
||||||
#then
|
#then
|
||||||
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
# urxvt_set_font "${URXVT_FONT_NAME}:size=${URXVT_FONT_SIZE}"
|
||||||
#fi
|
#fi
|
||||||
|
|||||||
Reference in New Issue
Block a user