3

I was over on the openwrt forum and I had a user help me with making a script, but I am having trouble with it.

Basically I have a openwrt router with a microphone attached, and I want to record throughout the day, automatically. He told me to try while loop. I took the while loop and just tried the arecord command, which labels the file correctly but for some reason it will put a ? at the end of the file name so its like 2013-02-10-12:20:10.wav? seems it keeps me from transferring it over via ftp.

I get the error unexpected end of file expecting "done" or something like that.

    while true
    do
      echo "recording started"
      arecord -f cd -d 10 `date +"%Y-%m-%d-%T"`.wav
    done
andyADD
  • 610
  • 1
  • 6
  • 20
  • it shouldn't happen. Try turning on the shell debugging with `set -vx` and see if you see anything happening that doesn't make sense. Good luck. – shellter Feb 11 '13 at 03:09
  • also, does the `?` at the end of the file indicate that it's still recording? What argument in your entry above indicates "only record for X amt of time"? OR Are you running on something that is connected to windows? Windows won't let you message with files that are "open". In a true linux environment, having a '?' in a filename shouldn't be an issue, but the ftp client may require you to use an option to turn off filename expansion. There are several places this could be a problem, so the fastest solution is to construct small test cases to see where the problem is. Good luck. – shellter Feb 11 '13 at 05:00
  • Shelltor, -d 10 means duration is 10 seconds. – andyADD Feb 11 '13 at 05:12

1 Answers1

0

It works, I tested the following on OpenWRT attitude adjustment r35725

root@openwrt3:/# cat file 
while true
do
  echo `date +"%Y-%m-%d-%T"`
done
root@openwrt3:/# ./file 
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:01
2013-02-22-18:40:02
^C
root@openwrt3:/# 
Saverio Proto
  • 1,085
  • 9
  • 20