Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 28 |
Nodes: | 6 (0 / 6) |
Uptime: | 51:33:02 |
Calls: | 422 |
Files: | 1,025 |
Messages: | 90,554 |
#!/bin/bash
# see if there are any Debian updates and pop-up a notice if there are
# needs an /etc/sudoers.d/adm-apt-privs that has
# Cmnd_Alias ADM_COMMANDS = /usr/bin/apt update
# %adm ALL = (root) NOPASSWD: ADM_COMMANDS
# get a temporary file
tempf=$(mktemp -q --tmpdir=/tmp -t updXXXXX)
stat=$?
if [ ${stat} != 0 ]; then
echo "OhNoes!!! Unable to create a temporary file. Status: ${stat}"
exit 9
fi
size=$(ls -s $tempf | awk '{print $1}')
[ $size != "0" ] && \
notify-send -u critical "Debian updates available" "$(cat $tempf)"
Also, you should quote "$tempf".
[ -s "$tempf" ] && notify-send ...
is there any way that
$(mktemp -q --tmpdir=/tmp -t updXXXXX)
would return a 0 status and a filename with embedded spaces .. or with anything that would require quoting?