Subject: xargs arguments are not passed to grep

From: Sergiu Bordei <[email-masked]>
Date: Fri, 15 Sep 2017 11:47:46 +0200

Hello,

please find an error detected when is used a combination of "xargs" and
"grep", arguments {} are not substituted in grep construction:
expected results:
echo "inga"|grep -c "i"
1
user@box1:~$ a="i"; echo `echo "inga"|grep -c $a`
1

but was necessary tu use it in combination with xargs:

user@box1:~$ echo "i" | xargs -I{} echo $(echo {} ;a=$(echo {}) ; echo $a ;
echo "inga"|grep -c $a)
i i 0
user@box1:~$ echo "i" | xargs -I{} echo $(echo {} ;a=`echo {}` ; echo $a ;
echo "inga"|grep -c $a)
i i 0
user@box1:~$ echo "i" | xargs -I{} echo $(echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a)
i i 0
user@box1:~$ echo "i" | xargs  -I{} echo `echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a`
i i 0
user@box1:~$ echo "i" | xargs -I{} echo `echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a`
i i 0
user@box1:~$ echo "i" | xargs -I{} echo `echo {} ;a={} ; echo $a ; echo
"inga"|grep -c $a`
i i 0

Thanks,
Sergiu Bordei