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

Re: bash scripting question (variables and spaces)



On Tue, 19 Mar 2002, Karsten Heymann wrote:

> Hi,
> 
> I have once again come upon bash problem I can't solve. I'm writing a
> little bash frontend and one of the programs expects a option that includes
> spaces and is composed from two other shell var's. Example:
> 
> #!/bin/bash
> A="Hello"
> B="Karsten"
> C=$A $B 
> someprog --greeting $C
> 
> Whatever I do now, --greeting receices only the "Hello" part. I've
> tried some other variants too:
> 
> C="$A $B"
> C=\"$A $a\B"
> C='$A $B'
> C=$A\ $B
> C=`echo $A $B`
> 
> What works is 
> someprog --greeting "Hello Karsten"
> but that's no solution.

try someprot --greeting "$A $B"

There's an excelleng bash scripting HOWTO (don't know the URL right of the 
top of my head) that should be very useful.

> 
> Please help :-)
> 
> Karsten
> 
> 

-- 
Paul F. Pearson (ppearson@hiwaay.net)     http://home.hiwaay.net/~ppearson/
"Lord heal our land. Father heal our land. Hear our cry and turn our nation 
back to You" - Heal Our Land, _Magnify The Lord_ (Integrity Music)



Reply to: