Yes, that is as expected. Alias does not use arguments.
So, what happens is:
alias foo="echo hello`$1`"
This defines foo
as an alias of
echo hello`$1`
$1
of your current shell is probably empty. The backticks around it will execute $1
as command at the time you define the alias and use the output. And executing nothing will result in nothing. So the alias effectively becomes echo hello
.
Then you do:
test bar
Replacing test
with foo
(it is probably what you actually did), results therefore in
echo hello bar
and that is where your space comes from.
If you want to create an alias-like thing that accepts arguments, look at functions.
foo2(){
echo "Hello$1"
}
foo2 bar
which is what you wanted.