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

Petr Vorel pvorel@suse.cz
Fri Jun 3 14:24:49 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

Kind regards,
Petr


More information about the ltp mailing list