#!/bin/SH#取当前脚本的绝对路径srcDir=$ (CD"$ (dirname"$0")";pwd) #设置库所在路径libDir=${srcdir}"/j1900runlib/*"#设置目标路径desDir="/usr/lib/x86_64_linux_gnu"#将库文件全部拷贝至指定路径CP$libDir $desDir # joins the absolute path of the current script to the environment variableEcho$srcDir >>/etc/LD. so.conf# Reload environment variable Ldconfig
The above content is written to copylib.sh.
1, first get the absolute path of the script execution, not directly with the $PWD, in the command line execution there will be a problem
2, QT library files placed in the J1900runlib folder, stitching out the library file path
3. Destination Address
4. Copy the QT library file to Desdir
5. Add the absolute path of the current script to the environment variable
6. Reload Environment variables
Execute copylib.sh can complete the deployment of the program, after the completion of the program can be directly started.
Linux shell completes automatic deployment of QT programs