用shell批量更改库文件名,软链接成.so结尾
rzrk:~/luzhi # ldconfig ldconfig: /usr/local/lib/libsvn_fs_base-1.so.0 is not a symbolic link ldconfig: /usr/local/lib/libcharset.so.1 is not a symbolic link ldconfig: /usr/local/lib/libpcrecpp.so.0 is not a symbolic link ldconfig: /usr/local/lib/libzookeeper_mt.so.2 is not a symbolic link ldconfig: /usr/local/lib/libzookeeper_st.so.2 is not a symbolic link ldconfig: /usr/local/lib/libluajit-5.1.so.2 is not a symbolic link ldconfig: /usr/local/lib/libsqlite3.so.0 is not a symbolic link ldconfig: /usr/local/lib/libpcreposix.so.0 is not a symbolic link ldconfig: /usr/local/lib/libprotobuf.so.8 is not a symbolic link ldconfig: /usr/local/lib/libiconv.so.2 is not a symbolic link ldconfig: /usr/local/lib/libpcre.so.1 is not a symbolic link ldconfig: /usr/local/lib/libexpat.so.1 is not a symbolic link ldconfig: /usr/local/lib/libbsoncpp.so.0 is not a symbolic link ldconfig: /usr/local/lib/liblog4cxx.so.10 is not a symbolic link ldconfig: /usr/local/lib/libprotobuf-lite.so.8 is not a symbolic link ldconfig: /usr/local/lib/librabbitmq.so.1 is not a symbolic link ldconfig: /home/rzrk/server/lib/libaprutil-1.so.0 is not a symbolic link ldconfig: /home/rzrk/server/lib/libapr-1.so.0 is not a symbolic link
当我们使用ldconfig命令出现这种情况的时候,说明是库文件命名有问题,所以我们要做一个软件链接。
#!/bin/bash ld_path=/root/ld.txt ldconfig &> $ld_path sed -i ‘/^ *$/d‘ $ld_path if test `wc -l $ld_path | awk ‘{print $1}‘` -eq 0 then echo “allisok...” else cat $ld_path | awk ‘{ print$2 }‘ | while read line do n1=`echo $line | awk -F ‘.‘ ‘{ print$1 }‘` n2=`echo $line | awk -F ‘.‘ ‘{print$2}‘` n3=`echo $line | awk -F ‘.‘ ‘{print$3}‘` ln -sv $line "$n1.$n3.$n2" done fi ldconfig
rzrk:~/luzhi #chmod +x 1.sh rzrk:~/luzhi # ./1.sh `/usr/local/lib/libsvn_fs_base-1.0.so‘ -> `/usr/local/lib/libsvn_fs_base-1.so.0‘ `/usr/local/lib/libcharset.1.so‘ -> `/usr/local/lib/libcharset.so.1‘ `/usr/local/lib/libpcrecpp.0.so‘ -> `/usr/local/lib/libpcrecpp.so.0‘ `/usr/local/lib/libzookeeper_mt.2.so‘ -> `/usr/local/lib/libzookeeper_mt.so.2‘ `/usr/local/lib/libzookeeper_st.2.so‘ -> `/usr/local/lib/libzookeeper_st.so.2‘ `/usr/local/lib/libluajit-5.so.1‘ -> `/usr/local/lib/libluajit-5.1.so.2‘ `/usr/local/lib/libsqlite3.0.so‘ -> `/usr/local/lib/libsqlite3.so.0‘ `/usr/local/lib/libpcreposix.0.so‘ -> `/usr/local/lib/libpcreposix.so.0‘ `/usr/local/lib/libprotobuf.8.so‘ -> `/usr/local/lib/libprotobuf.so.8‘ `/usr/local/lib/libiconv.2.so‘ -> `/usr/local/lib/libiconv.so.2‘ `/usr/local/lib/libpcre.1.so‘ -> `/usr/local/lib/libpcre.so.1‘ `/usr/local/lib/libexpat.1.so‘ -> `/usr/local/lib/libexpat.so.1‘ `/usr/local/lib/libbsoncpp.0.so‘ -> `/usr/local/lib/libbsoncpp.so.0‘ `/usr/local/lib/liblog4cxx.10.so‘ -> `/usr/local/lib/liblog4cxx.so.10‘ `/usr/local/lib/libprotobuf-lite.8.so‘ -> `/usr/local/lib/libprotobuf-lite.so.8‘ `/usr/local/lib/librabbitmq.1.so‘ -> `/usr/local/lib/librabbitmq.so.1‘ `/home/rzrk/server/lib/libaprutil-1.0.so‘ -> `/home/rzrk/server/lib/libaprutil-1.so.0‘ `/home/rzrk/server/lib/libapr-1.0.so‘ -> `/home/rzrk/server/lib/libapr-1.so.0‘
本文出自 “天道酬勤” 博客,请务必保留此出处http://8855546.blog.51cto.com/8845546/1641977
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。