Re: VDR plugin options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 30.01.2010 19:23, schrieb VDR User:
> On Sat, Jan 30, 2010 at 3:07 AM, Udo Richter <udo_richter@xxxxxx> wrote:
>> The correct way to place every array element as one parameter, without
>> doing any additional whitespace separation, is this:
>>
>> "$vdrbin" -L "$vdrlib" "${vdrplug[@]}"
>>
>> In contrast, "${vdrplug[*]}" merges all to one parameter, ${vdrplug[@]}
>> does another whitespace separation run.
> 
> What makes that "correct"?  Just sounds like a different (and more
> complicated, ..I guess) way to accomplish the same end result, but no
> more "correct" then using double/single quotes.

Correct in the sense of using arrays to build up a command line, not in
a sense of The One And Only Solution (tm).

> I'm no bash expert but STRING="$STRING -P'asdf arg'" works equally as
> well as ARRAY=( "${ARRAY[@]}" <new item> ) in my experience.  What am
> I missing?

Well, not much, except that I would do it this way:

PLUGINS[${#PLUGINS[*]}]="-Psoftdevice -vo xv:full -ao
alsa:mixer:pcm=default"


For a more complex (and a bit constructed) case:

PLUGINS="$PLUGINS -P\"hello --aaa=\\\"A B C\\\"\""
or
PLUGINS="$PLUGINS -P'hello --aaa=\"A B C\"'"
or
PLUGINS[${#PLUGINS[*]}]="-Phello --aaa=\"A B C\""
or
PLUGINS[${#PLUGINS[*]}]="-Phello --aaa='A B C'"

Arrays have the advantage that they spare one level of quoting, don't
need eval, and are a bit more 'ordered', but on the other hand are
bash-only, and cannot be exported to sub-shells.

(runvdr extreme has a quoting function, so you do it with even less
quoting like this: AddPlugin hello --aaa="A B C")


Cheers,

Udo

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux