软件安装
#!/bin/bash
echo "开始安装BiliExp,请选择如下选项继续(请以root权限运行)"
echo "0.退出安装"
echo "1.安装(默认)"
echo "2.卸载"
read -p "请输入序号:" choose
if [ $choose = '0' ]
then
echo "执行完成"
exit 0;
fi
if [ $choose = '2' ]
then
rm -f /usr/local/bin/BiliExp
rm -rf /etc/BiliExp
sed -i '/BiliExp/d' /var/spool/cron/crontabs/root
echo "卸载完成"
exit 0;
fi
read -p "是否需要在这里简单配置账户信息,否则需要安装完成后去/etc/BiliExp/config.json配置(y/n)" choose
if [ $choose = 'y' ] || [ $choose = 'Y' ]
then
read -p "请输入SESSDATA:" SESSDATA
read -p "请输入bili_jct:" bili_jct
read -p "请输入DedeUserID:" DedeUserID
sed -i "s/账号SESSDATA/$SESSDATA/g" ./config/config.json
sed -i "s/账号bili_jct/$bili_jct/g" ./config/config.json
sed -i "s/账号uid/$DedeUserID/g" ./config/config.json
fi
echo "开始安装文件..."
cp ./BiliExp /usr/local/bin/
chmod 755 /usr/local/bin/BiliExp
mkdir /etc/BiliExp
cp ./config/config.json /etc/BiliExp/
echo "开始配置crontab以在每天12:00启动..."
echo "0 12 * * * /usr/local/bin/BiliExp -c /etc/BiliExp/config.json -l /var/log/BiliExp.log" >> /var/spool/cron/crontabs/root
service crond reload
service cron reload
echo "安装完成,详细配置请看/etc/BiliExp/config.json文件"
springboot启动脚本
springboot启动脚本
read默认值
#!/bin/bash
read -t 5 -p "5秒内,请输入一个数,默认为10:" num
num=${num:-10}
echo "num=$num"
#!/bin/bash
read -p "请输入一个数:" num
if [ -z "${num}" ];then
num=10
fi
echo "num is $num"