Fix hostname showing directory when no hostname

Because `dnsmasq.leases` shows not having a hostname as `*`, bash will expand it to directory if we weren't using double quotes.

This adds double quotes to prevent expansion.

Closes #144
This commit is contained in:
c79
2019-11-04 23:05:14 +02:00
committed by GitHub
parent 016fd2b38f
commit 2ebc784700

View File

@ -869,7 +869,7 @@ print_client() {
if [[ -f $CONFDIR/dnsmasq.leases ]]; then
line=$(grep " $mac " $CONFDIR/dnsmasq.leases | tail -n 1)
ipaddr=$(echo $line | cut -d' ' -f3)
hostname=$(echo $line | cut -d' ' -f4)
hostname=$(echo "$line" | cut -d' ' -f4)
fi
[[ -z "$ipaddr" ]] && ipaddr="*"