#!/bin/bash
ip=ip a |grep -w "global eth0" |awk -F 'inet ' '{print$2}'|awk -F '/' '{print$1}'
Ipformat=echo ${ip//./-}
startwith=“tcs”
hostname=“
s
t
a
r
t
w
i
t
h
−
startwith-
startwith−Ipformat”
echo $hostname
hostnamectl set-hostname $hostname
04-29
9163