Re: Feature Request: C struct-like template

2021-01-14 Thread Chet Ramey
On 1/14/21 4:44 AM, William Park wrote: Here is another feature request. In C struct, eg. struct { char date[7], dev[16], ver[32], rev[10], ... } you just access variables, and compiler will do the offsetting. I would like something like that, where I don't have to do the book

Re: Feature Request: C struct-like template

2021-01-14 Thread Greg Wooledge
On Thu, Jan 14, 2021 at 07:16:12PM +0700, pepa65 wrote: > On 14/01/2021 16.44, William Park wrote: > > Then, I just use variable "rev" and that would be equivalent to > > ${@:55:10}. > > So you could just do: rev=(${template[@]:55:10}) Needs more quotes.

Re: Feature Request: C struct-like template

2021-01-14 Thread pepa65
On 14/01/2021 16.44, William Park wrote: > Then, I just use variable "rev" and that would be equivalent to > ${@:55:10}. So you could just do: rev=(${template[@]:55:10}) With a little function like this, you could call: Struct template date 7 dev 16 ver 32 rev 10 and get what you want with an exi

Feature Request: C struct-like template

2021-01-14 Thread William Park
Here is another feature request. In C struct, eg. struct { char date[7], dev[16], ver[32], rev[10], ... } you just access variables, and compiler will do the offsetting. I would like something like that, where I don't have to do the bookkeeping. Right now, I am doing set -- .