#!/bin/bash
lease=/var/lib/dhcpd/dhcpd.leases
while read line;
do
ipaddr=$(grep -E "lease" "$line" | sed 's/lease\ //' | sed s/.$//)
macaddr=$(grep -E "hardware ethernet" "$line" | sed 's/\ hardware\ ethernet\ //' | sed s/.$//)
hostname=$(grep -E "client\-hostname" "$line" | sed 's/client\-hostname\ \"//' | sed s/.$// | sed s/.$//)
echo "IP Address is: "$ipaddr""
echo "MAC Address is: "$macaddr""
echo "Hostname is: "$hostname""
done < $lease
Все эти команды из консоли отрабатываются, но не в скрипте.