Provisioning-switchs/configs/switches/script

13 lines
283 B
Text
Raw Normal View History

2020-08-14 13:34:51 +02:00
#!/bin/bash
dir='../../configs-backup/'
name=$1
port=$(cat $dir$name.bak | grep interface | tail -n 1 | awk '{print $2}')
echo "hostname: \"$name\"" > $name.yml
echo "nb_ports: $port" >> $name.yml
echo "interfaces:" >> $name.yml
cat $dir$name.bak | grep interface -A 3 | less