[LTP] [PATCH 3/8] tst_test.sh: Improve pattern for allowed variables

Cyril Hrubis chrubis@suse.cz
Fri Jun 3 15:23:03 CEST 2022


Hi!
> > >  	if [ -n "$TST_TEST_PATH" ]; then
> > > -		for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
> > > +		for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`'"'"'].*//'); do
> >                                                                                            ^
> > 											   Isn't
> > 											   the
> > 											   content
> > 											   between
> > 											   []
> > 											   just
> > 											   set?
> 
> > Shouldn't adding just ' between the [] suffice? The " is already there.
> 
> Well, '"'"' was my version of adding ' (quoted with " and ' at the start and end
> were for ending previous '.
>
> But this is shorter: '\'', therefore suggest
> 
> -		for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
> +		for _tst_i in $(grep '^[^#]*\bTST_' "$TST_TEST_PATH" | sed 's/.*TST_//; s/[='\''"} \t\/:`].*//'); do

I would say that '\'' is stil insane, but I guess that we can't do
better than that.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list