test_if.sh
2011-10-09 14:16
85 查看
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}
#!/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}
相关文章推荐
- test-definitions/blob/master/auto-test/go-bindata/go-bindata.sh
- mybatis的参数 <if test="_parameter != null" > </if>
- test-definitions/blob/master/auto-test/iostat/iostat.sh
- <s:if test>的应用
- if,test命令中的符号详解
- mybatis if test 字符串和字符的表示
- <c:set><c:if test=””>联合使用,使用el表达式对较复杂对象进行比较处理
- Linux编程 23 shell编程(结构化条件判断 命令if -then , if-then ... elif-then ...else,if test)
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用 《转》
- Unix下的C编译脚本 test.sh
- mybatis if test 不为空字符串或null
- (test-it.sh)
- Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info
- s:if标签的test中取result和session的值并比较
- mybatis **-mapping.xml文件中if test表达式逻辑判断“并且”,不能用&&
- <c:if test="${uns ne ‘admin’}">
- <c:if test=""></c:if>如何判断空(使用例子)
- struts2 if 标签 test属性
- MyBatis if test 字符串判断问题
- test-definitions/blob/master/auto-test/gprof/gprof.sh