install_zj.sh脚本优化

来源:互联网 发布:北京尚学堂 java ppt 编辑:程序博客网 时间:2024/05/29 13:04
#!/bin/bash# Author:    zhangji0910# Function:  pexpect comm pscp、pssh# example:   sh install_zj.sh # Others:    pscp、psshscript_dir=$(cd $(dirname $0);pwd)print_time=$(date '+%F %T')tar zxf pexpect-*.tar.gz -C /tmpfile_1=$( [ -e /usr/bin/pscp ]&& echo $? )file_2=$( [ -e /usr/bin/pssh ]&& echo $? )file_3=$( [ -e /usr/bin/scp_echo ]&& echo $? )file_4=$( [ -e /usr/bin/INSTALL ] && echo $? )file_5=$( [ -e /usr/bin/pexpect.py ]&& echo $? )file_6=$( [ -e /usr/bin/pexpect.pyc ]&& echo $? )if [[ $file_1 == 0 && $file_2 == 0 && $file_3 == 0 && $file_4 == 0 && $file_5 == 0 && $file_6 == 0  ]]; then echo -e "$print_time [$?]:\033[0;32m pscp and pssh Already installed !!!\033[0m" echo -e "You confirm the installation \033[0;35m [(y|n)|(Y|N)]?: \033[1;32m" (export TMOUT=5; read  input echo -e "\033[0m"  if [ "$input" = "y" ] || [ "$input" = "Y" ]; then        cp -v /tmp/pexpect-1109/* /usr/bin  echo -e ""     [ $? -eq 0 ] && echo -e "$print_time [$?]:\033[0;33m pscp and pssh Replace the successful\033[0m"  echo -e ""     rm -r /tmp/*     exit 0 else   echo -e "\033[0;33m STOP!"   echo -e ""   exit 1 fi )else     echo -e "$print_time\033[0;36m [$?]: Ready to Install...\033[0m" echo -e "" cp -v /tmp/pexpect-*/* /usr/bin echo -e ""    echo -e "$print_time [$?]:\033[0;32m pscp and pssh install Success \033[0m"      rm -r /tmp/pexpect-* exit 1fi


 

0 0
原创粉丝点击