开发者

zsh alias within function

Good morning,

In zshell I have an alias as follows:

alias foo='echo FooBar!'

Which of course works fine.

I have a function wherein I'm trying to actually 'execute' the alias, where it doesn't.

foo_fun () {
    echo "About to foo!"
    `$foo`
    $foo
    eval $foo
    eval `$foo`
    echo "Just food...wait what?开发者_C百科"
}

I'm having a bear of a time coming up with reasonable search terms for this. Any thoughts?

I also tried:

"$foo"

which yields a 'permission denied' message. (wut?)

TIA o/


Aliases aren't variables, you treat them like normal commands. Just run 'foo'. Most likely $foo was undefined and returned nothing; "" will give you "permission denied" too

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜