startvm()
{
startguest
}
Is there a way use one line to get this ? actually I want startvm=startguest
startvm()
{
startguest
}
Is there a way use one line to get this ? actually I want startvm=startguest
Your question is not so clear. But I guess what you need is an alias
:-
alias startvm='startguest'
It doesn't work
#!/bin/bash
xx()
{
echo "xx"
}
alias yy='xx'
yy
It will report
./xx.sh: line 9: yy: command not found
Oh I got now what you are asking. You can use eval
for this:
#!/bin/bash
xx()
{
echo "xx"
}
yy=xx
eval $yy
Thanks, if alias work that's perfect
I have a script is
xx()
{
something
}
zz()
{
something
}
main()
{
aa
bb
xx
}
in another script I want to call "main" BUT, the xx I want to be zz, and don't want to change main() function anything, here you are use eval $xx
Just out of curiosity... what are you trying to achieve here!!
why don't you call these functions as it is?