In a Linux environment, automate installation steps for multiple packages:
1, find the software package, extract the name of the package to establish the decompression path (in order to let us more clearly find our files)
Pkg= ' Find ${package_path}-name *bin*.tar.gz | Sed-n ' $ ' p ' (assuming the name of the package I'm looking for has BIN)
T_dir= ' basename ${pkg} | Awk-f '. Tar ' ' {print '} ' (read package name)
Rm-r/opt/${t_dir}
Mkdir/opt/${t_dir}
Tar-xvzf ${pkg}-c/opt/${t_dir}
Find/opt/${t_dir}-name "*.sh"-exec Dos2unix ' {} ' \; (format for. sh files in the package)
Chown-r ${username}:${_users_groupname} Opt/${t_dir} for the established file change owner
chmod +x-r Opt/${t_dir} additional executable permissions
Generally in such a way as Tomcat, Apache and other software is the equivalent of installation completed, as long as the attention to the path and permissions on the line.
But I'm here. Only the main code, the general use of variables to determine whether the variable is empty, to find files to determine whether the file is found, after the execution of the command to determine whether the correct implementation of the command. After the software installation is complete, check the environment for proper operation of the software.
such as commonly used variables such as the written configuration file, referenced in the script. ./include/global.inc or source./include/global.inc