[Klug-general] Bash scripting help

Karl Lattimer karl at qdh.org.uk
Sat May 2 09:39:10 UTC 2009


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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://mailman.lug.org.uk/pipermail/kent/attachments/20090502/ac06f71e/attachment.pgp 


More information about the Kent mailing list