[ -d "$LTPROOT/testcases/bin" ] ||
{
echo "FATAL: LTP not installed correctly"
echo "INFO: Follow directions in INSTALL!"
exit 1
}
if [ "$BYTES" -eq 0 ]; then
BYTES=$((256 * 1024 * 1024))
fi
>/dev/null 2>&1 &
cat <<-EOF >&1
WARNING: The use of -x can cause unpredictable failures, as a
result of concurrently running multiple tests designed
to be ran exclusively.
Pausing for 10 seconds..."
EOF
if [ “$RANDOMRUN” != “0” ]; then
echo “not eq 0”
fi
if ! find “$DMESG_DIR” -size 0 -exec rm {} + ; then
echo “cd to $DMESG_DIR failed: $?”
fi
如果变量TEST不存在时,则输出 “变量TEST为空!”:
if [ ! "$TEST" ]; then
echo "变量TEST为空!"
else
echo "变量TEST不为空值!"
fi
如果wget命令存在:
if which wget >/dev/null 2>&1; then
如果变量TEST存在,输出 “test not empty”
如果chmod操作失败,输出异常:
如果cd进不去(目标不存在),操作失败,则输出异常:
unset SCRATCHDEV
[ -n "$SCRATCHDEV" ] && \
{
cat ${LTPROOT}/runtest/fsx >> ${TMP}/alltests ||
{
echo "FATAL: unable to create fsx-linux tests command file"
exit 1
}
}
if [ -n "$TAG_RESTRICT_STRING" ]
then
mv -f ${TMP}/alltests ${TMP}/alltests.orig
grep $TAG_RESTRICT_STRING ${TMP}/alltests.orig > ${TMP}/alltests #Not worth checking return codes for this case
fi
${LTPROOT}/IDcheck.sh || \
{
echo "WARNING: required users and groups not present"
echo "WARNING: some test cases may fail"
}
如果变量a为1,或者变量b为1,则输出cat中的输出信息:
如果变量a不能1,而且变量b也不为1,则输出echo "all not
[ "$a" -eq 1 ] || [ "$b" -eq 1 ] && \
{
cat <<-EOF >&1
###############################################################
Done executing testcases.
LTP Version: $version_date
###############################################################
EOF
} || echo "all not 1"
[ “$LOOP_DEV” ] && losetup -d $LOOP_DEV