我的代码工作正常,第二天我得到了
./Desktop/audiolog.sh: 32: [: /proc/: unexpected operator
./Desktop/audiolog.sh: 13: ./Desktop/audiolog.sh: Illegal number: 08
可能是几秒钟内的数字08?任何指针将非常感谢
#!/bin/sh
DAY=$(date +%d)
MO=$(date +%m)
YR=$(date +%y)
SE=$(date +%S)
H=$(date +%H)
M=$(date +%M)
NOW=$(date)
DURATION=$(((60 - M) * 60-SE))
PART=$(find /mnt/hgfs/Audio\ Log/ -type f -name "RBLoggerAudio ${DAY}-${MO}-${YR}\ ${H}*" | wc -l)
reset
echo "Recording for $DAY $MO $YR - $H 00"
echo "Started at $NOW"
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
if [ "$PART" -eq 0 ]
then
arecord -f cd -c 1 -d$DURATION -t raw -v -v | lame -b 64 -q8 -mm -r - /mnt/hgfs/Audio\ Log/"RBLoggerAudio "$DAY-$MO-$YR\ $H"00".mp3
else
arecord -f cd -c 1 -d$DURATION -t raw -v -v | lame -b 64 -q8 -mm -r - /mnt/hgfs/Audio\ Log/"RBLoggerAudio "$DAY-$MO-$YR\ $H"00 - Part - "$PART.mp3
fi
pid=$(ps -opid= -C audiolog.sh)
while [ -d /proc/$pid ] ; do
sleep 1
done && ./Desktop/audiolog.sh
最佳答案
改变这个
while [ -d /proc/$pid ] ; do
与
while [ -d "/proc/$pid" ] ; do
关于linux - 非法号码-Shell脚本,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27797998/