声明:此文章紧做为笔记,同时可让他人参考;
- linux脚本的用法;
- bash脚本用法
- bash写法
- shell写法
- shell判断执行结果
#!/bin/bash
#!/bin/bash
DST_ROOTFS_DIR="/home/DoneLin/桌面/ltib/rootfs/"
DST_ROOTFS_FILE_NAME="rootfs.tar.bz2"
cd $DST_ROOTFS_DIR
rm -rvf $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME
sync
if [ ! -f "$DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME" ]; then
chmod a+rwx $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME
rm -rvf $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME
echo "chmod a+rwx $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME"
echo "rm -rvf $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME"
if [ $? -eq 0 ]; then
echo " **>>>>$DST_ROOTFS_FILE_NAME exisit, rm successed! "
else
echo " !!!>>> warning: $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME not exits"
fi
fi
sync
URPATH=$(cd "$(dirname "$0")"; pwd)
echo "Your PWD is: "$URPATH
cp -rfv /home/DoneLin/projects/我的例程程序qt/我的例程程序main/build-myExeFile-i_MX6-Release/myExeFile $DST_ROOTFS_DIR/opt/我的例程程序/myExeFile
if [ $? -eq 0 ]; then
echo " **>>>>copy myExeFile to $DST_ROOTFS_DIR/opt/我的例程程序/myExeFile successed! "
else
echo " XXX >>>>Error: Copy myExeFile failed!"
exit
fi
tar -jcf $DST_ROOTFS_FILE_NAME *
if [ $? -eq 0 ]; then
echo " **>>>>OK! Tar jcvf $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME Dir successed! "
chmod a+rwx $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME
else
echo " XXX >>>>Error: tar jcvf $DST_ROOTFS_DIR$DST_ROOTFS_FILE_NAME failed!"
exit
fi