发现:组合多个“-exec”语句不适用于 toybox / Android?
find: combining multiple "-exec" statements not working with toybox / Android?
我正在尝试在 Android phone 运行 Oreo / 8.0 上解决这个问题,toybox 0.7.3-android。
我正在尝试获取文件夹内的文件列表及其各自的运行时间。我是运行这个命令:
find . -type f -exec stat -c %n {} \; -exec stat -c %y {} \;
或
find . -type f -exec stat -c %n "{}" \; -exec stat -c %y "{}" \;
在这两种情况下,我都只得到第一次调用 "stat" 的结果。我是在监督什么,还是 toybox 在 Android 上的工作方式?
如果玩具箱不能做多个exec
,还有其他选择。
在这种特殊情况下,您可以只使用一个统计数据:
find . -type f -exec stat -c "$(echo -e "%n\n%y")" {} \;
# or just insert the newline verbatim in single quotes:
find . -type f -exec stat -c '%n
%y' {} \;
对于 运行 多个命令(假设路径不包含换行符):
find . -type f -print | while IFS= read -r f; do
stat -c $n "$f";
stat -c %y "$f";
done
我正在尝试在 Android phone 运行 Oreo / 8.0 上解决这个问题,toybox 0.7.3-android。
我正在尝试获取文件夹内的文件列表及其各自的运行时间。我是运行这个命令:
find . -type f -exec stat -c %n {} \; -exec stat -c %y {} \;
或
find . -type f -exec stat -c %n "{}" \; -exec stat -c %y "{}" \;
在这两种情况下,我都只得到第一次调用 "stat" 的结果。我是在监督什么,还是 toybox 在 Android 上的工作方式?
如果玩具箱不能做多个exec
,还有其他选择。
在这种特殊情况下,您可以只使用一个统计数据:
find . -type f -exec stat -c "$(echo -e "%n\n%y")" {} \;
# or just insert the newline verbatim in single quotes:
find . -type f -exec stat -c '%n
%y' {} \;
对于 运行 多个命令(假设路径不包含换行符):
find . -type f -print | while IFS= read -r f; do
stat -c $n "$f";
stat -c %y "$f";
done