Предполагая, что исторический UNIX, который, как я предполагаю, bash
или более поздние оболочки не поддерживаются, вы можете сделать это в соответствии с POSIX
if IFS= read -r line 2> /dev/null < file; then
result="${line%"${line#????}"}"
printf '%s\n' "$result"
else
printf >&2 '%s\n' 'Unable to read file contents or no newline found in the file'
fi
Вы можете проверить статус службы iptables в CentOS:
sudo systemctl status iptables
sudo systemctl status ip6tables
если службы еще не запущены, вы можете запустить их как:
sudo systemctl start iptables
sudo systemctl start ip6tables