1 2 3 4 5 6 7 8 9 10 |
# 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 |
1 2 3 |
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi |