[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: looping over variables & exporting them at the same time ?
From: |
Greg Wooledge |
Subject: |
Re: looping over variables & exporting them at the same time ? |
Date: |
Sun, 28 Jan 2024 23:07:35 -0500 |
On Sun, Jan 28, 2024 at 10:11:43PM -0500, Zachary Santer wrote:
> # Surround the contents of var with spaces
> var=" ${var} "
> # Replace all instances of " xtest " in the variable with " "
> var="${var// xtest / }"
> # Remove the leading space we added
> var="${var# }"
> # Remove the trailing space we added
> var="${var% }"
While this does work, I still prefer treating a list as a real list,
and expanding it out into an array for whatever operations are desired.
If the problem evolves, and the desired operations become more complex --
or if the problem statement we've been given is not complete -- then
having the list items in separate array elements will be an advantage.
- looping over variables & exporting them at the same time ?, heavy . gear5130, 2024/01/27
- Re: looping over variables & exporting them at the same time ?, Greg Wooledge, 2024/01/27
- Re: looping over variables & exporting them at the same time ?, Paxsali, 2024/01/27
- Re: looping over variables & exporting them at the same time ?, Zachary Santer, 2024/01/28
- Re: looping over variables & exporting them at the same time ?,
Greg Wooledge <=
- Re: looping over variables & exporting them at the same time ?, Zachary Santer, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Greg Wooledge, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, alex xmb sw ratchev, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Paxsali, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Paxsali, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Greg Wooledge, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Paxsali, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Greg Wooledge, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Zachary Santer, 2024/01/29
- Re: looping over variables & exporting them at the same time ?, Zachary Santer, 2024/01/29