在 zsh 函数中传递所有参数
Passing all arguments in zsh function
我正在尝试在我的 .zshrc 中编写一个简单的函数来隐藏 find
.
的所有错误(主要是“权限被拒绝”)
现在,如何将调用函数给出的所有参数传递给 find
?
function superfind() {
echo "Errors are suppressed!"
find $(some magic here) 2>/dev/null
}
我可以 ...
但这是愚蠢的!我相信有一个非常简单的方法。
使用$@
,它扩展到所有位置参数,例如:
superfind () {
echo "Errors are suppressed!"
find "$@" 2> /dev/null
}
我正在尝试在我的 .zshrc 中编写一个简单的函数来隐藏 find
.
现在,如何将调用函数给出的所有参数传递给 find
?
function superfind() {
echo "Errors are suppressed!"
find $(some magic here) 2>/dev/null
}
我可以 ...
但这是愚蠢的!我相信有一个非常简单的方法。
使用$@
,它扩展到所有位置参数,例如:
superfind () {
echo "Errors are suppressed!"
find "$@" 2> /dev/null
}