Merge pull request #122 from derimagia/uppercase-bash-3

Fix issue #121 - incompatability with bash < 4
This commit is contained in:
Dave Wikoff 2018-04-27 10:23:50 -04:00 committed by GitHub
commit d24f64da48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,8 +70,8 @@ function ssh_resolve() {
# Host regex
# HostName resolved.domain.com
read -r -a ssh_array <<<"${ssh_line}"
ssh_optcode="${ssh_array[0]}"
if [[ ${ssh_optcode^^} == HOST ]]; then
ssh_optcode="$(echo "${ssh_array[0]}" | tr '[:upper:]' '[:lower:]')"
if [[ $ssh_optcode == HOST ]]; then
# Host
ssh_found=false
# Iterate through aliases looking for a match
@ -84,7 +84,7 @@ function ssh_resolve() {
break
fi
done
elif $ssh_found && [[ ${ssh_optcode^^} == HOSTNAME ]]; then
elif $ssh_found && [[ $ssh_optcode == HOSTNAME ]]; then
# HostName, but only if ssh_found is true (the last Host entry matched)
# Replace all instances of %h with the Host alias
echo "${ssh_array[1]//%h/$domain}"