You are not logged in.
Hello,
i'm writing a script to rip a dvd to my harddisk, but i have one small problem...
Here is a code exampe:
# read disc title
echo "==> read disc title..."
disc_title=`lsdvd | grep "Disc Title:" | cut -c 13-128`
echo "===> disc title: $disc_title"
This works fine, but the programm "lsdvd" always puts "libdvdread: Using libdvdcss version 1.2.11 for DVD access" to my bash output...
Is there a way to prevent this behaviour?
Thank you for your help
Offline
You can redirect the output of shell programs like this:
ᶘ ᵒᴥᵒᶅ
Offline
Try using |& instead of | after lsdvd.
Yes,I am
Offline
Thank you
"|&" works fine
But i have one more small problem:
I start mplayer from the script, run it three seconds and then kill it, and search in the output of mplayer for the audio streams. This works well, but i always get the output of the "kill" command...
mplayer dvd://1 -v |& grep -E "^audio stream" &
pid_mplayer=$!
sleep 2
kill $pid_mplayer
#kill $pid_mplayer > /dev/null
#kill $pid_mplayer 2> /dev/null
sleep 1
Here's the output of the script:
audio stream: 0 format: ac3 (5.1) language: en aid: 128.
audio stream: 1 format: ac3 (stereo) language: cs aid: 129.
audio stream: 2 format: ac3 (stereo) language: de aid: 130.
audio stream: 3 format: ac3 (stereo) language: pl aid: 131.
./dvd: Zeile 119: 4276 Exit 1 mplayer dvd://1 -v 2>&1
4277 Beendet | grep -E "^audio stream"
(sorry, the output is in german, "Zeile" means "line" and "Beendet" means "closed")
Does anybody have an idea how i can prevent this output?
Offline
kill $pid_mplayer > /dev/null 2>&1
Offline
Hello,
i tried that but it doesn't worked...
audio stream: 0 format: ac3 (stereo) language: en aid: 128.
audio stream: 1 format: ac3 (stereo) language: de aid: 129.
./rip: Zeile 104: 2336 Exit 1 mplayer dvd://$i -v -vo null -ao null -dvd-device $dvd_device 2>&1
2337 Beendet | grep -E "^audio stream"
Offline
Oops, sorry. I think that the error message you are seeing is not from 'kill', but is the stderr output of the script itself; or more correctly, it is the output of the bash process that runs your script.
Therefore, you have to redirect the stderr of your script to /dev/null.
Thus if your script is named 'rip', then run it like this.
$ rip 2> /dev/null
Last edited by rockin turtle (2012-02-20 19:41:28)
Offline