An alias is a
command substitution. But you're trying to use it as a substitution for an
argument to another command. It just doesn't work that way, whether in a function or not. In this case a simple variable substitution is what you want to use.
Code:
machine='user@machine'
ssh()
{
command ssh "$1"
}
ssh $machine
Edit: another option is to make the entire function call the alias:
Code:
ssh()
{
command ssh "$1"
}
alias sshmachine='ssh user@machine'
sshmachine
PS: Please use
[code][/code] tags around your code, to preserve formatting and to improve readability.
PPS: It's generally recommended to avoid the use of
eval whenever possible. In this case it's completely unnecessary, especially since you're giving the complete path to the executable. But if you need to avoid a conflict between the ssh command and the ssh function (or an alias), use the
command built-in. I've updated the examples above to demonstrate this.