Issue
My code was working fine then the next day I get
./Desktop/audiolog.sh: 32: [: /proc/: unexpected operator
./Desktop/audiolog.sh: 13: ./Desktop/audiolog.sh: Illegal number: 08
Is it perhaps the number 08 within the seconds? Any pointers will be great thanks
#!/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
Solution
Change this
while [ -d /proc/$pid ] ; do
with
while [ -d "/proc/$pid" ] ; do
Answered By - Skynet