[TriLUG] scripting question

Chris Merrill chris at webperformance.com
Tue Mar 15 17:21:02 EDT 2011


Taking the hints from the responders, the solution is to change:

if ! lame --genre-list | grep "${command[$((i+1))]}" >/dev/null; then

to:

if ! lame --genre-list 2>&1 | grep "${command[$((i+1))]}" >/dev/null; then


Thanks!
Chris


On 3/15/2011 5:07 PM, Jon Carnes wrote:
> Put a "2" in front of the ">" to indicate that you want console output
> redirected to /dev/null
> 
> On Tue, 2011-03-15 at 16:13 -0400, Chris Merrill wrote:
>> The FLAC>MP3 converter script I posted about earlier has one annoying little
>> behavior.  It spews a lot of crap to the screen.  I am somewhat confident it
>> comes from this line:
>>
>> if ! lame --genre-list | grep "${command[$((i+1))]}" >/dev/null; then
>> 	command[$((i+1))]=""
>> 	[ "$verbose" ] && echo "Nullified the genre tag as the specified genre does not exist."
>> fi
>>
>> where command[$((i+1))] is some parameter it is looking for in the output from
>> the "lame --genre-list" command.
>>
>> I think the output from "lame --genrelist" was supposed be grepped and all
>> output piped to null, but it is appearing on the console anyway.
>>
>> Can anyone suggest a modification to the above code that would keep the output
>> from reaching the console (except the echo, of course) ?   I should probably
>> dig up some bash scripting references figure this out myself...but I'm supposed
>> to be working right now   ;)
>>
>>
>>
>>
>> -- 
>> ------------------------------------------------------------------------ -
>> Chris Merrill                           |  Web Performance, Inc.
>> chris at webperformance.com                |  http://webperformance.com
>> 919-433-1762                            |  919-845-7601
>>
>> Web Performance: Website Load Testing Software & Services
>> ------------------------------------------------------------------------ -


-- 
------------------------------------------------------------------------ -
Chris Merrill                           |  Web Performance, Inc.
chris at webperformance.com                |  http://webperformance.com
919-433-1762                            |  919-845-7601

Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -



More information about the TriLUG mailing list