[LTP] [PATCH] network/nfs_lib.sh: Use double quotes for grep pattern

Alexey Kodanev alexey.kodanev@oracle.com
Thu Jun 18 14:38:30 CEST 2020


On 17.06.2020 21:43, Petr Vorel wrote:
> Hi Alexey, Xiao,
> 
>> Perhaps this:
> 
>> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
>> index 59b373e..9c8f163 100644
>> --- a/testcases/lib/tst_net.sh
>> +++ b/testcases/lib/tst_net.sh
>> @@ -172,8 +172,7 @@ tst_rhost_run()
>>         local output=
>>         local ret=0
>>         if [ -n "${TST_USE_SSH:-}" ]; then
>> -               output=`ssh -n -q $user@$RHOST "sh -c \
>> -                       '$pre_cmd $cmd $post_cmd'" $out 2>&1 || echo 'RTERR'`
>> +               output=$(ssh -n -q $user@$RHOST "$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR')
>>         elif [ -n "$TST_USE_NETNS" ]; then
>>                 output=`$LTP_NETNS sh -c \
>>                         "$pre_cmd $cmd $post_cmd" $out 2>&1 || echo 'RTERR'`
> 
> Nice! Much simpler than what what I was just going to post (sed replacement).
> Would it work for rsh as well? i.e. can it work without sh -c?
> I have no working rsh setup.
> 
> And removing it from all 3 variants would be great (keeping them to be the same,
> also it might allow to also use shell functions, which doesn't work with sh -c
> "..."). Why was sh -c "..." used anyway?

Hi Petr,

Don't remember, so if all work without it I would remove it. For rsh,
I doubt that's is used now days, let's remove it too? The replacement (ssh)
in the tst_rhost_run() has been for a long time already.

> BTW I have more tst_net.sh, but I post them after we solve this one (as
> replacing quotes with sed, which is in my prepared patchset is ugly).
> 
> Kind regards,
> Petr
> 



More information about the ltp mailing list