[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] add and expand
From: |
Peter West |
Subject: |
Re: [Help-bash] add and expand |
Date: |
Tue, 6 Jun 2017 11:06:57 +1000 |
> On 6 Jun 2017, at 9:52 am, Val Krem <address@hidden> wrote:
>
> Thank you Peter,
> What I did not mention in my previous posting was after adding a prefix I
> want export the expanded variables as one variable.I amde a littel progress
>
>
> #! /bash/bin
>
> set — one two three
Not using arrays now.
> test1="${@/#/Number}"
> echo $test1
> resulted
> Numberone Numbertwo Numberthree
test1 is a single variable. The echo shows the contents of the variable test1.
You may have problems with the use of the variable because the shell is reading
the contents of test1 as three separate words, thanks to IFS, which treats
space, tab and newline as word separators.
As long as you use “$test1” rather than the unquoted $test1, the contents will
be treated as a single variable. What specific problems are you having?
> How do I wrap this in quotation mark and treat it as one variable?
>
> test2="Numberone Numbertwo Numberthree"; export test2
>
> echo ${test2}
> I should get this:-
>
> Numberone Numbertwo Numberthree
--
Peter West
address@hidden
This is the disciple who is bearing witness to these things…
signature.asc
Description: Message signed with OpenPGP
- [Help-bash] add and expand, Val Krem, 2017/06/05
- Re: [Help-bash] add and expand, Peter West, 2017/06/05
- Re: [Help-bash] add and expand, Val Krem, 2017/06/05
- Re: [Help-bash] add and expand,
Peter West <=
- Re: [Help-bash] add and expand, Greg Wooledge, 2017/06/06
- Re: [Help-bash] add and expand, Val Krem, 2017/06/06
- Re: [Help-bash] add and expand, Greg Wooledge, 2017/06/06
- Re: [Help-bash] add and expand, Val Krem, 2017/06/07
- Re: [Help-bash] add and expand, Dennis Williamson, 2017/06/07
- Re: [Help-bash] add and expand, Greg Wooledge, 2017/06/08
- Re: [Help-bash] add and expand, Dennis Williamson, 2017/06/08
- Re: [Help-bash] add and expand, Greg Wooledge, 2017/06/08