Fix static analysis errors
This commit is contained in:
parent
05c189cfa4
commit
bedf7e18a9
4 changed files with 27 additions and 25 deletions
|
@ -1,2 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
# put personal scripts on the PATH to be callable
|
# put personal scripts on the PATH to be callable
|
||||||
export PATH="$(du $HOME/.local/bin | cut -f2 | tr '\n' ':')$PATH"
|
PATH=$(du "$HOME"/.local/bin | cut -f2 | tr '\n' ':')$PATH
|
||||||
|
export PATH
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
export LC_ALL="en_US.utf-8"
|
export LC_ALL="en_US.utf-8"
|
||||||
export LANG="en_US.utf-8"
|
export LANG="en_US.utf-8"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
## Integration at the Bottom
|
## Integration at the Bottom
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ _LIVE_AGENT_SOCK_LIST=()
|
||||||
|
|
||||||
_debug_print() {
|
_debug_print() {
|
||||||
if [[ $_DEBUG -gt 0 ]]; then
|
if [[ $_DEBUG -gt 0 ]]; then
|
||||||
printf "%s\n" $1
|
printf "%s\n" "$1"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ find_all_gpg_agent_sockets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
find_all_gnome_keyring_agent_sockets() {
|
find_all_gnome_keyring_agent_sockets() {
|
||||||
_GNOME_KEYRING_AGENT_SOCKETS=$(find /tmp/ -type s -name ssh 2>/dev/null | grep '/tmp/keyring-.*/ssh$')
|
_GNOME_KEYRING_AGENT_SOCKETS=$(find /tmp/ -type s -name "ssh" 2>/dev/null | grep '/tmp/keyring-.*/ssh$')
|
||||||
_debug_print "$_GNOME_KEYRING_AGENT_SOCKETS"
|
_debug_print "$_GNOME_KEYRING_AGENT_SOCKETS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,33 +88,33 @@ test_agent_socket() {
|
||||||
|
|
||||||
find_live_gnome_keyring_agents() {
|
find_live_gnome_keyring_agents() {
|
||||||
for i in $_GNOME_KEYRING_AGENT_SOCKETS; do
|
for i in $_GNOME_KEYRING_AGENT_SOCKETS; do
|
||||||
test_agent_socket $i
|
test_agent_socket "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
find_live_osx_keychain_agents() {
|
find_live_osx_keychain_agents() {
|
||||||
for i in $_OSX_KEYCHAIN_AGENT_SOCKETS; do
|
for i in $_OSX_KEYCHAIN_AGENT_SOCKETS; do
|
||||||
test_agent_socket $i
|
test_agent_socket "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
find_live_gpg_agents() {
|
find_live_gpg_agents() {
|
||||||
for i in $_GPG_AGENT_SOCKETS; do
|
for i in $_GPG_AGENT_SOCKETS; do
|
||||||
test_agent_socket $i
|
test_agent_socket "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
find_live_ssh_agents() {
|
find_live_ssh_agents() {
|
||||||
for i in $_SSH_AGENT_SOCKETS; do
|
for i in $_SSH_AGENT_SOCKETS; do
|
||||||
test_agent_socket $i
|
test_agent_socket "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function fingerprints() {
|
function fingerprints() {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
while read l; do
|
while read -r l; do
|
||||||
[[ -n $l && ${l###} == $l ]] && ssh-keygen -l -f /dev/stdin <<<$l
|
[[ -n $l && ${l###} == "$l" ]] && ssh-keygen -l -f /dev/stdin <<<"$l"
|
||||||
done <$file
|
done <"$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
find_all_agent_sockets() {
|
find_all_agent_sockets() {
|
||||||
|
@ -135,9 +135,6 @@ find_all_agent_sockets() {
|
||||||
_LIVE_AGENT_LIST=$(echo $_LIVE_AGENT_LIST | tr ' ' '\n' | sort -n -t: -k 2 -k 1 | uniq)
|
_LIVE_AGENT_LIST=$(echo $_LIVE_AGENT_LIST | tr ' ' '\n' | sort -n -t: -k 2 -k 1 | uniq)
|
||||||
_LIVE_AGENT_SOCK_LIST=()
|
_LIVE_AGENT_SOCK_LIST=()
|
||||||
_debug_print "SORTED: $_LIVE_AGENT_LIST"
|
_debug_print "SORTED: $_LIVE_AGENT_LIST"
|
||||||
if [ -e ~/.ssh/authorized_keys ]; then
|
|
||||||
_FINGERPRINTS=$(fingerprints ~/.ssh/authorized_keys)
|
|
||||||
fi
|
|
||||||
if [[ $_SHOW_IDENTITY -gt 0 ]]; then
|
if [[ $_SHOW_IDENTITY -gt 0 ]]; then
|
||||||
i=0
|
i=0
|
||||||
for a in $_LIVE_AGENT_LIST; do
|
for a in $_LIVE_AGENT_LIST; do
|
||||||
|
@ -146,13 +143,11 @@ find_all_agent_sockets() {
|
||||||
# technically we could have multiple keys forwarded
|
# technically we could have multiple keys forwarded
|
||||||
# But I haven't seen anyone do it
|
# But I haven't seen anyone do it
|
||||||
akeys=$(SSH_AUTH_SOCK=$sock ssh-add -l)
|
akeys=$(SSH_AUTH_SOCK=$sock ssh-add -l)
|
||||||
key_size=$(echo ${akeys} | awk '{print $1}')
|
fingerprint=$(echo "${akeys}" | awk '{print $2}')
|
||||||
fingerprint=$(echo ${akeys} | awk '{print $2}')
|
|
||||||
remote_name=$(echo ${akeys} | awk '{print $3}')
|
|
||||||
if [ -e ~/.ssh/authorized_keys ]; then
|
if [ -e ~/.ssh/authorized_keys ]; then
|
||||||
authorized_entry=$(fingerprints ~/.ssh/authorized_keys | grep $fingerprint)
|
authorized_entry=$(fingerprints ~/.ssh/authorized_keys | grep "$fingerprint")
|
||||||
fi
|
fi
|
||||||
comment=$(echo ${authorized_entry} | awk '{print $3,$4,$5,$6,$7}')
|
comment=$(echo "${authorized_entry}" | awk '{print $3,$4,$5,$6,$7}')
|
||||||
printf "export SSH_AUTH_SOCK=%s \t#%i) \t%s\n" "$sock" $((i + 1)) "$comment"
|
printf "export SSH_AUTH_SOCK=%s \t#%i) \t%s\n" "$sock" $((i + 1)) "$comment"
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
|
@ -162,7 +157,7 @@ find_all_agent_sockets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
set_ssh_agent_socket() {
|
set_ssh_agent_socket() {
|
||||||
if [ "$1" = "-c" -o "$1" = "--choose" ]; then
|
if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
|
||||||
find_all_agent_sockets -i
|
find_all_agent_sockets -i
|
||||||
|
|
||||||
if [ -z "$_LIVE_AGENT_LIST" ]; then
|
if [ -z "$_LIVE_AGENT_LIST" ]; then
|
||||||
|
@ -171,7 +166,7 @@ set_ssh_agent_socket() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? "
|
echo -n "Choose (1-${#_LIVE_AGENT_SOCK_LIST[@]})? "
|
||||||
read choice
|
read -r choice
|
||||||
if [ -n "$choice" ]; then
|
if [ -n "$choice" ]; then
|
||||||
n=$((choice - 1))
|
n=$((choice - 1))
|
||||||
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ]; then
|
if [ -z "${_LIVE_AGENT_SOCK_LIST[$n]}" ]; then
|
||||||
|
@ -192,17 +187,17 @@ set_ssh_agent_socket() {
|
||||||
|
|
||||||
# set agent pid
|
# set agent pid
|
||||||
if [ -n "$SSH_AUTH_SOCK" ]; then
|
if [ -n "$SSH_AUTH_SOCK" ]; then
|
||||||
export SSH_AGENT_PID=$(($(echo $SSH_AUTH_SOCK | cut -d. -f2) + 1))
|
export SSH_AGENT_PID=$(($(echo "$SSH_AUTH_SOCK" | cut -d. -f2) + 1))
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh-find-agent() {
|
ssh-find-agent() {
|
||||||
if [ "$1" = "-c" -o "$1" = "--choose" ]; then
|
if [ "$1" = "-c" ] || [ "$1" = "--choose" ]; then
|
||||||
set_ssh_agent_socket -c
|
set_ssh_agent_socket -c
|
||||||
return $?
|
return $?
|
||||||
elif [ "$1" = "-a" -o "$1" = "--auto" ]; then
|
elif [ "$1" = "-a" ] || [ "$1" = "--auto" ]; then
|
||||||
set_ssh_agent_socket
|
set_ssh_agent_socket
|
||||||
return $?
|
return $?
|
||||||
else
|
else
|
||||||
|
@ -214,6 +209,6 @@ ssh-find-agent() {
|
||||||
# Automatically add ssh-agent to any new ssh connection
|
# Automatically add ssh-agent to any new ssh connection
|
||||||
ssh-find-agent -a
|
ssh-find-agent -a
|
||||||
if [ -z "$SSH_AUTH_SOCK" ]; then
|
if [ -z "$SSH_AUTH_SOCK" ]; then
|
||||||
eval $(ssh-agent) >/dev/null
|
eval "$(ssh-agent)" >/dev/null
|
||||||
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
|
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,12 +2,14 @@
|
||||||
zstyle ':completion:*' accept-exact '*(N)'
|
zstyle ':completion:*' accept-exact '*(N)'
|
||||||
zstyle ':completion:*' use-cache on
|
zstyle ':completion:*' use-cache on
|
||||||
zstyle ':completion:*' cache-path ~/.zsh/cache
|
zstyle ':completion:*' cache-path ~/.zsh/cache
|
||||||
|
# shellcheck disable=SC2016
|
||||||
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")';
|
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")';
|
||||||
|
|
||||||
# Load any custom zsh completions we've installed
|
# Load any custom zsh completions we've installed
|
||||||
if [ -d ~/.zsh-completions ]; then
|
if [ -d ~/.zsh-completions ]; then
|
||||||
for completion in ~/.zsh-completions/*
|
for completion in ~/.zsh-completions/*
|
||||||
do
|
do
|
||||||
|
# shellcheck source=/dev/null
|
||||||
source "$completion"
|
source "$completion"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue