Skip to content

Instantly share code, notes, and snippets.

@Pillar1989
Created April 8, 2018 10:40
Show Gist options
  • Save Pillar1989/e2778d34b2253e8133e6201f1ba8cf45 to your computer and use it in GitHub Desktop.
Save Pillar1989/e2778d34b2253e8133e6201f1ba8cf45 to your computer and use it in GitHub Desktop.
#!/bin/sh
c="true"
count=0
while c=="true"
do
d="true"
python3 recorder.py > log.txt
cat log.txt | grep "channel: 0 RMS: " | awk -F':' '{print $NF}' | while read LINE
do
echo ${LINE}
if [ "${LINE}" = "0 dB" ]; then
echo "get it"
d="false"
fi
if [ "${LINE}" = "\-inf dB" ]; then
echo "get it"
d="false"
fi
done
# x=$(cat log.txt | grep "channel: 0 RMS: " | grep "0 dB" | awk -F':' '{print $NF}')
# echo ${x}
# if [ ${x} ]; then
# break
# fi
# x=$(cat log.txt | grep "channel: 0 RMS: " | grep "\-inf dB" | awk -F':' '{print $NF}')
# if [ ${x} ]; then
# break
# fi
if [ "${d}" = " false" ]; then
break
fi
sleep 1
count=$((count + 1))
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>${count}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment