如何将我的输入令牌传递给 zsh 别名中的嵌套命令

How can I pass my input token to a nested command in a zsh alias

我有这个 zsh 别名:

alias ogf="source <(clone_git_file -ts )"

clone_git_file -ts returns 可以在shell中执行的字符串。使用 source <(...) 效果很好(执行我当前 shell 中的代码),但我无法将 </code> 标记传递到嵌套命令中。</p> <p>顺便找到<a href="">here</a>上面的<code>source用法

我怎样才能做到这一点,正确传递令牌?如果我从别名中删除 source <( 并执行此操作:

source <(ogf my_url)

my_url 已传递,一切正常。

别名不带参数。当您定义别名时,</code> 会展开。您想改用函数。</p> <pre><code>ogf () { source <(clone_git_file -ts "") }


这也不仅仅是阻止 </code> 立即展开的问题;如果你尝试过</p> <pre><code>alias ogf='source <(clone_git_file -ts )'

然后 ogf foo 将扩展为 ogf foo</code> 将扩展为当前 shell 的 <code> 的值。