Reputation: 8610
I have given command which will find a particular file named /etc/limits in one of rpm package insatlled but when run on my system getting error not the desired result. Below is the command
find . -name '*.rpm' | while read A; do $RPM -qpl $A | grep etc/limits; \
if [ $? -eq 0 ]; then echo $A; fi; done
/etc/limits
When I run this command getting below error
bash: syntax error near unexpected token `/etc/limits'
Could anybody tell me what is going wrong here?
Upvotes: 0
Views: 1761
Reputation: 123468
It's evident that your while
loop takes input from find
so you don't need /etc/limits
after done
in your script. Saying:
find . -name '*.rpm' | while read A; do
$RPM -qpl $A | grep /etc/limits;
if [ $? -eq 0 ]; then echo $A; fi;
done
should work. If you wanted to make the while
loop read from a file you'd have said:
while read A; do ... done < /path/to/input/file
Upvotes: 1