通过脚本运行时,ls -lR不起作用

时间:2018-07-28 20:00:33

标签: bash ls

当我从提示符处运行命令时,它会给出结果,但是当我编写脚本时,它说ls无法访问。下面是我的脚本

for server in $(echo $prod_daemon | sed "s/,/ /g")
    do
            echo "********$server PROD collecting the files*********"
                                    ssh -TAtt ubuntu@18.221.144.194 ssh -A -o ConnectTimeout=5 -o BatchMode=yes -o StrictHostKeyChecking=no ubuntu@$server "find /lunera/code/*/current/ -type f -print0 |xargs -0 ls -lR -1 | awk '"'"'{print $5"\t\t"$9}'"'"'|sort -n|awk 'NF' " >daemon0$a

请帮助

1 个答案:

答案 0 :(得分:1)

如果在我尝试遵循的过程中,您正在尝试在每台服务器上查找最大文件(在您的搜索位置内),那么使用ssh -o ProxyCommand比嵌套两个单独的{{1} }手动调用,与完全调用ssh相比,使用find -printf更有意义。

因此:

ls