[SOLVED]: Is "2nd level indirection" possible in bash?
Walter Dnes
waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Sun Sep 2 22:48:51 UTC 2012
I finally figured out a compromise that does not use eval. I want
to stay away from eval. I was trying to bite off too much in one step...
* This does *NOT* work without eval
dataline="2432187.20, 1248.2754, 1947, 01, 01, .0, .0, .0"
f_yr="25:4"
yyyy="\${dataline:${f_yr}}"
* This does work without eval
dataline="2432187.20, 1248.2754, 1947, 01, 01, .0, .0, .0"
f_yr_start=25
f_yr_len=4
yyyy="${dataline:${f_yr_start}:${f_yr_len}}"
echo "${yyyy}"
The key is to substitute an integer separately for the start and
length parameters, rather than trying to write the entire expression to
be evaluated.
--
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
I don't run "desktop environments"; I run useful applications
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list