#2776 PR merged: Fix SC2091 in 310_network_devices.sh

Labels: fixed / solved / done, minor bug

jsmeix opened issue at 2022-03-21 11:37:

In rescue/GNU/Linux/310_network_devices.sh fix
SC2091: Remove surrounding $() to avoid executing output
in the line

if $( printf "%s\n" "${MAPPED_NETWORK_INTERFACES[@]}" | grep -qw ^$network_interface ) ; then

cf. https://github.com/rear/rear/commit/15567ede425401b008e5b1680db36a2c62752b8f#r68281832
that reads

I do not understand why $(...) command substitution is used here.
It looks as if it could be just removed but I am uncertain.
Perhaps I overlook some obscure magic?
But grep -q won't ouput anything so $(...) would execute nothing?

jsmeix commented at 2022-03-22 09:55:

@rmetrich
could you have a look here - if time permits?
(I ask you because it is your code.)

rmetrich commented at 2022-03-22 10:04:

Yes this $(...) didn't make any sense!

jsmeix commented at 2022-03-22 12:55:

@rmetrich
thank you for your review!

Now it's gone "this $(...) didn't make any sense" thing ;-)

jsmeix commented at 2022-03-23 14:36:

Only for completeness:
This one also belongs to
https://github.com/rear/rear/issues/1040#issuecomment-1062945160


[Export of Github issue for rear/rear.]