shell 如何在bash函数中使用任何bash命令

9lowa7mx  于 12个月前  发布在  Shell
关注(0)|答案(1)|浏览(146)

我尝试在bash函数中使用ls、cat等命令

Report()
{
    ls $1 |  sort -u
}
Report()

我得到了ls:命令未找到错误当我运行函数
在bash函数中不能使用bash命令吗?
我可以看到在函数中只使用echo的例子

s8vozzvw

s8vozzvw1#

在bash中调用函数时,不应使用括号

Report()
{
    ls $1 |  sort -u
};
Report;

相关问题