2022-11-11 21:31:56 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# Authors:Leitbogioro
|
|
|
|
# https://github.com/leitbogioro/
|
|
|
|
# https://www.zhihu.com/column/originaltechnic
|
|
|
|
UpdateLog="/var/log/packagesupdatefile.log"
|
|
|
|
if [ -f "$UpdateLog" ]; then
|
|
|
|
rm -rf $UpdateLog
|
|
|
|
fi
|
2022-11-18 23:46:45 +08:00
|
|
|
apt update | tee -a "$UpdateLog" > /dev/null 2>&1
|
2022-11-11 21:31:56 +08:00
|
|
|
UpdateRemind=`cat $UpdateLog | tail -n 1`
|
2022-11-18 23:46:45 +08:00
|
|
|
Result=$(echo $UpdateRemind | grep "*packages can be upgraded*")
|
|
|
|
if [ "$Result" != "" ]; then
|
|
|
|
printf "$UpdateRemind"
|
2022-11-11 21:31:56 +08:00
|
|
|
fi
|
|
|
|
rm -rf $UpdateLog
|