[Klug-general] Bash scripting help

dan danattwood at googlemail.com
Sat May 2 10:30:19 UTC 2009


Karl Lattimer wrote:
> On Sat, 2009-05-02 at 10:33 +0100, dan wrote:
>   
>> Karl Lattimer wrote:
>>     
>>> On Sat, 2009-05-02 at 09:53 +0100, dan wrote:
>>>   
>>>       
>>>> Ok i;ve been toying with this for hours now and it's sending me nuts so 
>>>> here's hoping someone can help
>>>>
>>>> I have the following chunk of bash code;
>>>>
>>>>  Pref="--type='tv,radio,podcast,five,itv,ch4' --since=24"
>>>>  zenity --info --text "$Pref"
>>>>
>>>>
>>>> This works fine and the call to zenity outputs a text box with; 
>>>> --type='tv,radio,podcast,five,itv,ch4' --since=24; as expected
>>>>
>>>> However when I then feed $Pref into a function if comes out as; 
>>>> --type="tv,radio,podcast,five,itv,ch4' --since=24; note the double quote 
>>>> before tv instead of a single qoute
>>>>
>>>> does anyone have any pointers on whats going on and how to fix this?
>>>>     
>>>>         
>>> All I can say is that's just fucking weird!
>>>
>>> hmm
>>>
>>> so I'd suggest trying two things, try using $PREF out of quotes entirely
>>> and in caps so e.g.
>>>
>>> zenity --info --text $PREF
>>>
>>> see what happens, report back.. I'm intrigued :/
>>>
>>> BR,
>>>  K
>>>   
>>>       
>> $Pref without the qoute fails completely. Thats expected though because 
>> of the space before --since.
>> Would putting pref in all caps make any difference - isn't it just the 
>> name of string?
>>     
>
> I think it makes a difference with sh rather than bash, I've had some
> quirks because of it once or twice.
>
> Erm... I'm seriously lost on this one
>
> you definitely have #!/bin/bash as the first line right?
>
> if that's the case, then this is just messed up...
>
> Is there any more code you want to share, see if we can find something
> else that's bugging it out?
>
> K,
>   
> ------------------------------------------------------------------------
Yes it's definitely a bash script

I'm not willing to give out the rest fo the code at the moment as i'm 
using it as learning project and don't really want anyone else to finish 
it for me. Although I will of course open source it all when i've finished!



More information about the Kent mailing list