【发布时间】:2015-08-17 16:56:34
【问题描述】:
当我使用递归 chown 时,我想在第一个错误时停止它。
$ chown -R /tmp/cache someuser
chown: changing ownership of `/tmp/cache/1/thumbnail/100x/9df78eab33525d08d6e5fb8d27136e95/h/d': Operation not permitted
chown: changing ownership of `/tmp/cache/1/thumbnail/100x/9df78eab33525d08d6e5fb8d27136e95/h': Operation not permitted
chown: changing ownership of `/tmp/cache/1/thumbnail/100x/9df78eab33525d08d6e5fb8d27136e95': Operation not permitted
chown: changing ownership of `/tmp/cache/1/thumbnail/100x': Operation not permitted
chown: changing ownership of `/tmp/cache/1/thumbnail': Operation not permitted
chown: changing ownership of `/tmp/cache/1': Operation not permitted
chown: changing ownership of `/tmp/cache': Operation not permitted
即我应该只得到echo $? 的第一个错误和状态代码“1”。
有可能吗?
【问题讨论】:
-
我投票决定将此问题作为题外话结束,因为它不是编程问题,最好在 unix.stackexchange.com 或 superuser.com 上提问
-
你忘了
-R吗? -
简而言之,不;我认为没有一种(标准)方法可以让
chown -R在第一个错误时停止。
标签: bash error-handling chown