[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Splitting variable into two numbers
From: |
Greg Wooledge |
Subject: |
Re: Splitting variable into two numbers |
Date: |
Tue, 20 Jul 2021 13:05:01 -0400 |
On Tue, Jul 20, 2021 at 06:15:32PM +0200, lisa-asket@perso.be wrote:
> I would like to split a variable containing two numbers delimited by a comma
>
> and transfer the two numbers into two variables p and q.
p=${input%,*} q=${input#*,}
> Input:
>
> var="{5,8}"
STOP!
All of a sudden, this is an X-Y problem. You don't have "two numbers
delimited by a comma". You have something else entirely. There are
curly braces now. I wonder what else is in there.
Is it really JSON?
What's the *actual* goal here? Where does this input come from, what
does it *really* look like (before any mangling you've already done
on the X-Y path), and what are you trying to do with it?
- Splitting variable into two numbers, lisa-asket, 2021/07/20
- Re: Splitting variable into two numbers, Leonid Isaev (ifax), 2021/07/20
- Re: Splitting variable into two numbers,
Greg Wooledge <=
- Splitting variable into two numbers, lisa-asket, 2021/07/20
- Re: Splitting variable into two numbers, Greg Wooledge, 2021/07/20
- Splitting variable into two numbers, lisa-asket, 2021/07/20
- Re: Splitting variable into two numbers, Greg Wooledge, 2021/07/20
- Splitting variable into two numbers, lisa-asket, 2021/07/20
- Re: Splitting variable into two numbers, Greg Wooledge, 2021/07/20
- Re: Splitting variable into two numbers, ikhxcsz7y xmbott, 2021/07/21
Re: Splitting variable into two numbers, Chris F.A. Johnson, 2021/07/20