我需要一个shell脚本,以下是要点。
rpm -qa | grep crfs
crfsprodserver-3.p313-rel.m.076.x86_64
cd /usr/local/crfsprodserver-3.p313/lib/
ls crfs*
我写的脚本如下:
1 for i in `cat /tmp/input.csv`
2 do
3 echo "$i" >>/tmp/rpm_details.csv
4 sshpass -p "MYPASS" ssh "$i" "rpm -qa | grep crfs" >>/tmp/rpm_details.csv ## will get all installed RPM details ##
5 cat /tmp/rpm_details.csv | grep crfs |awk 'BEGIN {FS="-";OFS="-";}{print $1,$2}'>>/tmp/rpm_path.csv ## to extract part of rpm ##
6 done
如何找出罐子的详细信息。直到第六行的代码段都很好,我正在获取所有详细信息
for j in `cat /tmp/rpm_path.csv`
do
cd /usr/local/"$j"/lib/;ls crfs* >>/tmp/jar_details.csv