Hello!
Need help with the following:
#!/bin/bash
streamripper http://mp3-live.swr.de/swr2_m.m3u -D ~/RadioMitschnitt -l 200 > /dev/null 2>&1
I want to change the script so that it asks for an input for "-l 200" (means length 200sec) and starts then with the new value for "-l".
Can I do this with stdin, or how does it work?
read val < /dev/tty
echo $val
Thank you, that works fine!
Now I'd like to add "if then" for the filename. So far it looks like this:
DATE=`date +%Y-%m-%d_%R`
echo "How long?"
read sec < /dev/tty
echo "Please enter the file name:"
read name < /dev/tty
streamripper http://mp3-live.swr.de/swr2_m.m3u -D ~/RadioMitschnitt -l $sec > /dev/null 2>&1 &&
mv ~/RadioMitschnitt/incomplete/*mp3 ~/RadioMitschnitt/$name.mp3 &&
rmdir ~/RadioMitschnitt/incomplete/
I would like to add
"Please enter the file name ('d' for actual time/date):"
so that the script looks like
if $name=d then name=$DATE
How does that work? I have no idea...