[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] add and expand
From: |
Val Krem |
Subject: |
Re: [Help-bash] add and expand |
Date: |
Mon, 5 Jun 2017 23:52:32 +0000 (UTC) |
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
test1="${@/#/Number}"
echo $test1
resulted
Numberone Numbertwo Numberthree
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
On Monday, June 5, 2017 6:26 PM, Peter West <address@hidden> wrote:
> On 6 Jun 2017, at 8:00 am, Val Krem <address@hidden> wrote:
>
> Hi all,
>
> I have an array and i want list the array elements with prefix. In this case
> my prefix is "Number"
>
>
> #! /bash/bin
>
> List=“one two three”
I don’t think List is an array.
List=(one two three)
is an array.
>
> my desired out put should be
> "Numberone, Numbertwo, Numberthree"
>
>
> I tried
>
> echo address@hidden and echo ${Name[@/#/Number]}
> did not work.
List=(one two three)
for n in address@hidden; do echo “Number$n”; done
(except with ascii double quote)
This works for me.
--
Peter West
address@hidden
This is the disciple who is bearing witness to these things…
- [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 <=
- Re: [Help-bash] add and expand, Peter West, 2017/06/05
- 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