image
image

|


Go Back   macosx.com > Mac Help Forums > Unix & X11

Reply
 
Thread Tools
  #1  
Old February 3rd, 2007, 12:42 AM
arri's Avatar
Registered User
 
Join Date: Mar 2003
Posts: 262
Thanks: 0
Thanked 0 Times in 0 Posts
arri is on a distinguished road
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
Reply With Quote
  #2  
Old February 3rd, 2007, 12:46 AM
arri's Avatar
Registered User
 
Join Date: Mar 2003
Posts: 262
Thanks: 0
Thanked 0 Times in 0 Posts
arri is on a distinguished road
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?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump


All times are GMT -5. The time now is 09:16 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.