You could build a function factory with eval, but in this case there is an even easier possibility: function ssh telnet su bash zsh tcsh { set_title "$0 $@" { command $0 "$@" } always { cd . } } This defines a function for ssh, telnet etc., $0 always evaluates to the name by which the function was called. --derf