|
#1
| ||||
| ||||
| redirecting stdout and stderr to /dev/null ?? i'm trying to make a script that starts mpg123 with my favorite radiostation, and displays info about the currently playing track. i succeeded so far, except for one problem; i don't manage to make to script silent, and only output the track-info. instead, on each loop, it outputs something that looks like the output of curl. on closer inspection, the terminals' titlebar actually very briefly shows the name 'curl' when it outputs, and 'sleep' for the rest of the time.. so appearantly mpg123 (or at least version 0.59r) uses curl, but how can i make that the output of curl doesn't show? here's the script: Code: #!/bin/sh
mpg123 -qr 44100 http://000.000.000.000:8014/ & > /dev/null 2>&1
oldrespons="ouwe zooi"
while [ 1 ]
do
respons=$(curl http://this.url-contains.info/logs/radio-playing.txt)
if [ "$oldrespons" != "$respons" ]
then
clear
echo "cliqhop: $respons"
oldrespons="$respons"
fi
sleep 2
done |
|
#2
| ||||
| ||||
| ah.. that's really stupid of me ![]() ofcourse i'm using curl myself... wow..bummer.. so this 'kind of' works: Code: #!/bin/sh
mpg123 -qr 44100 http://207.200.96.231:8014/ & > /dev/null 2>&1
oldrespons="ouwe zooi"
while [ 1 ]
do
respons=$(curl -s http://somafm.com/logs/cliqhop-playing.txt)
if [ "$oldrespons" != "$respons" ]
then
clear
echo "cliqhop: $respons"
oldrespons="$respons"
fi
sleep 10
done 'kind of' since i still get some error-information from mpg123 when i start the script. it's not so bad, but i wonder; am i redirecting the error-output the right way? maybe i didn't noice this before because mpg123 just reports very few errors? |