ifconfig -a | grep "UP" | grep -v "lo" | awk -F ": " '{ print $1 }'
#!/usr/bin/env bash
clear
echo "Подключаемся к хосту"
ssh name@server.lan << "EOF"
grep 'DOMAIN=' /etc/sysconfig/network-scripts/ifcfg-eth0 &> /dev/null; if [ $? -eq 0 ]; then echo "Domain is found"; else echo "Domain is not found"; fi
EOF
Подключаемся к хосту
Pseudo-terminal will not be allocated because stdin is not a terminal.
Domain is found
#!/bin/bash
clear
echo "Подключаемся к хосту"
ssh root@192.168.1.1 << "EOF"
yum -y screen
grep 'DOMAIN=' /etc/sysconfig/network-scripts/ifcfg-eth0 &> /dev/null; if [ $? -eq 0 ]; then export DOMAIN=locl.dom && sed -i '' -e "s|DOMAIN=.*$|DOMAIN=$DOMAIN|" /etc/sysconfig/network-scripts/ifcfg-eth0; else echo "DOMAIN=locl.dom" >> /etc/sysconfig/network-scripts/ifcfg-eth0; fi
service network restart
EOF