Update vmcreate1.sh

This commit is contained in:
2025-10-24 14:39:24 +00:00
parent 76d1c6153d
commit 44e371f19d

View File

@@ -22,7 +22,7 @@ while getopts "a:f:h" opt; do
esac
done
if [ $# -eq 0 && -v $file && ! -f $file ]; then
if [[ $# -eq 0 && -v $file && ! -f $file ]]; then
local input=y
echo "File $file does not exist. Use default 'hosts' file? Y/n: "
read input
@@ -36,7 +36,7 @@ if [ $# -eq 0 && -v $file && ! -f $file ]; then
fi
# Если заданы аргументы И файл
if [ $# -ne 0 && -v file ]; then echo "Please enter file OR arguments. Use '-f' flag for help"; exit 0; fi
if [[ $# -ne 0 && -v file ]]; then echo "Please enter file OR arguments. Use '-f' flag for help"; exit 0; fi
# Если заданы аргументы, то создаем временный файл
if [ $# -ne 0 ] then
@@ -46,7 +46,7 @@ if [ $# -ne 0 ] then
if [ $? -eq 0 ]
then
echo -n "$arg " >> ./hosts.tmp
echo $arg | cut -d '.' -f 3,4 | sed 's/\.//' >> hosts.tmp
echo hostname_generate $arg >> hosts.tmp
else
echo "Argument $arg is not valid IP address (10.10.*.*). Using next argument."
fi