help-bash
[Top][All Lists]
Advanced

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

Re: Have Bash to parse multiple space-contained words connected by \, t


From: Budi
Subject: Re: Have Bash to parse multiple space-contained words connected by \, the simplest way
Date: Mon, 23 Nov 2020 08:50:38 +0700

Solved! Thanks much

On 11/23/20, Daniel Mills <danielmills1@gmail.com> wrote:
>  Resending because I forgot to include the list.
>
> This is one of the rare use cases for read without -r.
>
> To put it in an array like you want:
> read -a parts <<<"$s"
> printf '%s\n' "${parts[@]}"
>
> On Sun, Nov 22, 2020 at 9:14 AM Budi <budikusasi@gmail.com> wrote:
>
>> How within a string, can we have Bash to parse multiple
>> space-contained words connected by escape char \, by the simplest way
>> (only 1-2 commands/lines) ?
>>
>> s="English phrases must be understood are as\ well, even\ if, as\ such"
>> How to achieve kind of in few variables (or enclosed by quote pair
>> instead of double quote):
>>
>> a="English"
>> b="phrases"
>> c="must"
>> d="be"
>> e="understood"
>> f="are"
>> g="as well,"
>> h="even if,"
>> i="as such"
>> or as array of s variable itself, etc
>>
>>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]