It looks interesting. I will be doing something as shown below:
printf "$frmt4_titl" "NAME"
which gives yellow color text with 4 spaces in the front
I do not want to have a long line. The idea is that I write relatively short format string, followed by the things I want to print.
I essence, I want to construct the format variables above in a better way.
---------- Post updated at 03:26 PM ---------- Previous update was at 03:22 PM ----------
Can I construct a variable name with a counter using a loop?
---------- Post updated at 03:34 PM ---------- Previous update was at 03:26 PM ----------
I have been thinking a bit more and variable names in shell are not designed to be dynamically created. So I suppose I would need to keep the code not much different.
There is nothing wrong with using printf. In fact I will use it. What I am trying to do is specify the format to printf. Then in my main script I call printf followed by the format string, followed by the strings to output. Else things will get too long if I put the actual format.
Thank you for this. Associative arrays are very nice, but cannot use them when running my scripts on some clusters I have available, which is a pity.
---------- Post updated at 05:45 AM ---------- Previous update was at 05:12 AM ----------
As an addition, I am constructing some mnemonic keywords from which I can quickly extract information. I use three attributes: s, v, and d.
Mnemonic examples:
1s one option
2s two options
3s three options
1sv one option with value
1s2v one option with two values
2sv two options with value
2svd two options with value and description
I want to determine the total number of attributes in the string as follows: