Update vmcreate1.sh

This commit is contained in:
2025-10-26 15:33:07 +00:00
parent 748dff3df2
commit 7a00563174

View File

@@ -148,10 +148,11 @@ if [[ $# -ne 0 && -v "$file" ]]; then
fi fi
# Проверка файла на соответствие шаблону IPv4 адреса и hostname, создаём временный файл из валидных строк # Проверка файла на соответствие шаблону IPv4 адреса и hostname, создаём временный файл из валидных строк
if [[ -e "$file" ]]; then if [[ $# -eq 0 && -e "$file" ]]; then
touch hosts.tmp touch hosts.tmp
echo -n "" > hosts.tmp echo -n "" > hosts.tmp
for line in $(cat "$file"); do for line in $(cat "$file"); do
echo "DEBUG line:$line"
ip=$(echo $line | cut -d ' ' -f 1) ip=$(echo $line | cut -d ' ' -f 1)
hostname=$(echo $line | cut -d ' ' -f 2) hostname=$(echo $line | cut -d ' ' -f 2)
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then