以下Linux shell脚本用来结音频配件进行暴力测试。如有更好脚本,欢迎提供。
-----------------------------------------------------------------------
#! /bin/sh
do
aplay /root/test.wav &
id=`ps | grep aplay | awk '{print $1}' | head -n 1` # get the process id
echo $id # print the process id
done
-----------------------------------------------------------------------
注:此处为什么用head,因为在buildroot下面,用ps | grep aplay会打印下面信息:
-----------------------------------------------------------------------
# ps | grep aplay
920 root aplay test.wav
922 root grep aplay
-----------------------------------------------------------------------