# create new directory and cd in single command
function mkdircd () { mkdir -p "$@" && eval cd "\"\$$#\""; }
# ssh to remote host and go to directory
function sshcd () { ssh username@"$@" -t "cd /path/dir1/dir2/ ; \$SHELL -l"; }
ALL_HOSTS="hostname1 hostname2 hostname3"
for AHOST in $ALL_HOSTS
do
alias ssh2"$AHOST"="sshcd $AHOST "
done
create/insert to .bashrc
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Then $ source ~/.bash_aliases , $ ssh2hostname1 should go there directly if ssh without password configured.