test_if.sh

 test_if.sh

 

#!/bin/bash

logfile=if.logs
checkfile="mydir1 myfile1 lnmydir1 lnmyfile1 hello.sh hello"

echo "start" > ${logfile}

for tempFile in ${checkfile}
do
  echo "checking ${tempFile}  exist ..." >> ${logfile}
  if [ -f ${tempFile} -o -d ${tempFile} -o -L ${tempFile} ] ; then
    echo "rm -rf ${tempFile} ..." >> ${logfile}
    rm -rf ${tempFile}
    echo "rm -rf ${tempFile} OK!" >> ${logfile}
  else
    echo "the ${tempFile} not exist!" >> ${logfile}
  fi
done

echo "begin mkdir mydir1 ..." >> ${logfile}
mkdir mydir1
echo "end   mkdir mydir1 ok!" >> ${logfile}

echo "begin touch myfile1 ..." >> ${logfile}
touch myfile1
echo "end   touch myfile1 ok!" >> ${logfile}

echo "begin ln -s mydir1 lnmydir1 ..." >> ${logfile}
ln -s mydir1 lnmydir1
echo "end   ln -s mydir1 lnmydir1 ok!" >> ${logfile}

echo "begin ln -s myfile1 lnmyfile1 ..." >> ${logfile}
ln -s myfile1 lnmyfile1
echo "end   ln -s myfile1 lnmyfile1 ok!" >> ${logfile}

echo "begin touch hello.sh ..." >> ${logfile}
touch hello.sh
echo "end   touch hello.sh ok!" >> ${logfile}

chmod 777 hello.sh

echo '' >> hello.sh
echo 'echo "hello my shell world"' >> hello.sh
echo '' >> hello.sh

ln -s hello.sh hello

sleep 2 

file mydir1  >> ${logfile}
file hello.sh  >> ${logfile}
file hello  >> ${logfile}

if test -d mydir1 -a -x hello.sh ; then
 
 echo "in  (if test -d mydir1 -a -x hello.sh) ..." >> ${logfile}
fi

echo "end!" >> ${logfile}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#!/bin/sh #安装插件 cd /root/mysql if test -e ./sharutils-4.6.1-2.x86_64.rpm then echo 'sharutils开始安装...' rpm -ivh sharutils-4.6.1-2.x86_64.rpm echo 'sharutils安装完成...' else echo 'sharutils文件不存在!' exit fi #安装msql8 if test -e ./mysql8.0.19_64-636.sh then if test -e ./mysql8.0.19_64-636.sh.sha256 then echo '准备安装mysql8' sh ./mysql8.0.19_64-636.sh else echo 'mysql8.sha256文件不存在!' exit fi else echo 'mysql8.sh文件不存在!' exit fi if [ $? -eq 0 ]; then echo 'mysql安装完成...' else echo 'mysql安装失败!' exit fi #执行重启不需验证 /topwalk/baseapp/bin/mysqld restart --skip_grant_tables #安装tcl sh ./tcl-install.sh if [ $? -eq 0 ]; then echo 'tcl安装完成...' else echo 'tcl安装失败!' exit fi #安装expect sh ./expect-install.sh if [ $? -eq 0 ]; then echo 'expect安装完成...' else echo 'expect安装失败!' exit fi #创建mysql用户,授权 sh ./initdb.sh if [ $? -eq 0 ]; then echo 'mysql用户创建,授权完成...' else echo 'mysql用户创建,授权失败!' exit fi ln -s /topwalk/baseapp/bin/mysqld /etc/init.d/ sed -i '/MYSQL_HOME/d' /etc/profile echo "export MYSQL_HOME=/topwalk/baseapp/mysql" >>/etc/profile echo 'export PATH=$PATH:$MYSQL_HOME/bin' >>/etc/profile systemctl enable mysqld source /etc/profile service mysqld restart #初始化库 /topwalk/baseapp/mysql/bin/mysql -udms -ptRstOpwalkroot0823 < topsql/CREATE_TOPBASIC.sql /topwalk/baseapp/mysql/bin/mysql -udms -ptRstOpwalkroot0823 < topsql/CREATE_TOPDMS.sql /topwalk/baseapp/mysql/bin/mysql -udms -ptRstOpwalkroot0823 < topsql/CREATE_TOPUIS.sql #初始化表 /topwalk/baseapp/mysql/bin/mysql -udms -ptRstOpwalkroot0823 TOPBASIC < topsql/TOPBASIC.sql /topwalk/baseapp/mysql/bin/mysql -udms -ptRstOpwalkroot0823 TOPDMS < topsql/TOPDMS.sql /topwalk/baseapp/mysql/bin/mysql -udms -ptRstOpwalkroot0823 TOPUIS < topsql/TOPUIS.sql #安装nginx cp -dpRf ./nginx /usr/local/ useradd nginx -m -d /usr/local/nginx/ -s /bin/bash chown -R nginx.nginx /usr/local/ngi
07-14
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值