软件安装

    1. #!/bin/bash
    2. echo "开始安装BiliExp,请选择如下选项继续(请以root权限运行)"
    3. echo "0.退出安装"
    4. echo "1.安装(默认)"
    5. echo "2.卸载"
    6. read -p "请输入序号:" choose
    7. if [ $choose = '0' ]
    8. then
    9. echo "执行完成"
    10. exit 0;
    11. fi
    12. if [ $choose = '2' ]
    13. then
    14. rm -f /usr/local/bin/BiliExp
    15. rm -rf /etc/BiliExp
    16. sed -i '/BiliExp/d' /var/spool/cron/crontabs/root
    17. echo "卸载完成"
    18. exit 0;
    19. fi
    20. read -p "是否需要在这里简单配置账户信息,否则需要安装完成后去/etc/BiliExp/config.json配置(y/n)" choose
    21. if [ $choose = 'y' ] || [ $choose = 'Y' ]
    22. then
    23. read -p "请输入SESSDATA:" SESSDATA
    24. read -p "请输入bili_jct:" bili_jct
    25. read -p "请输入DedeUserID:" DedeUserID
    26. sed -i "s/账号SESSDATA/$SESSDATA/g" ./config/config.json
    27. sed -i "s/账号bili_jct/$bili_jct/g" ./config/config.json
    28. sed -i "s/账号uid/$DedeUserID/g" ./config/config.json
    29. fi
    30. echo "开始安装文件..."
    31. cp ./BiliExp /usr/local/bin/
    32. chmod 755 /usr/local/bin/BiliExp
    33. mkdir /etc/BiliExp
    34. cp ./config/config.json /etc/BiliExp/
    35. echo "开始配置crontab以在每天12:00启动..."
    36. echo "0 12 * * * /usr/local/bin/BiliExp -c /etc/BiliExp/config.json -l /var/log/BiliExp.log" >> /var/spool/cron/crontabs/root
    37. service crond reload
    38. service cron reload
    39. echo "安装完成,详细配置请看/etc/BiliExp/config.json文件"

    springboot启动脚本

    springboot启动脚本
    read默认值

    1. #!/bin/bash
    2. read -t 5 -p "5秒内,请输入一个数,默认为10:" num
    3. num=${num:-10}
    4. echo "num=$num"
    1. #!/bin/bash
    2. read -p "请输入一个数:" num
    3. if [ -z "${num}" ];then
    4. num=10
    5. fi
    6. echo "num is $num"