【问题标题】:How can I pass a vetor element to the find command of unix?如何将向量元素传递给 unix 的 find 命令?
【发布时间】:2013-12-13 12:05:09
【问题描述】:

如何将数组元素传递给 unix 的 find 命令?例如。: 我尝试查找 tcs/*APPS[i] 但不工作

APPS=("av_bench" "mpeg4_decoder" "radio_sys" "vopd" "h263e" "h264dl" "sample" "sparse") 

for i in APPS
do
    DATA=$(find tcs/*APPS[i] -name log_packet_header.csv -exec bash -c 'get_data "{}"' \;)
    echo "APPS[i]"
done

谢谢

【问题讨论】:

  • 我没有时间建立一个完整的答案,但你看过 xargs 吗?

标签: shell unix find


【解决方案1】:

您需要遍历数组的元素。说:

for i in "${APPS[@]}"
do
    DATA=$(find tcs/"${i}" -name log_packet_header.csv -exec bash -c 'get_data "{}"' \;)
    echo "${i}"
done

【讨论】:

    猜你喜欢
    • 2012-02-04
    • 2015-02-17
    • 2011-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-20
    • 1970-01-01
    相关资源
    最近更新 更多