A
if [ -d ~/.ssh ]; then
# Touch files we expect to exist
if [ ! -e ~/.ssh/config ]; then touch ~/.ssh/config; fi
if [ ! -e ~/.ssh/known_hosts ]; then touch ~/.ssh/known_hosts; fi
# Parse ~/.ssh/known_hosts and ~/.ssh/config to find hosts
for x in `sed -e ’s/[, ].*//’ ~/.ssh/known_hosts; awk ‘/^Host [^*?]+$/{print $2}’ ~/.ssh/config`; do
# Don’t override commands
type $x > /dev/null 2>&1 && continue
alias $x=â€ssh $xâ€
# Remove the domainname
y=${x/.*/}
if [ “$y” != “$x” ]; then
if ! type $y > /dev/null 2>&1; then
alias $y=â€ssh $xâ€
fi
fi
# Remove prefix. Add prefixes you want removed here
y=${y/pf1-/}
y=${y/pf2-/}
if [ “$y” != “$x” ]; then
if ! type $y > /dev/null 2>&1; then
alias $y=â€ssh $xâ€
fi
fi
done
fi