Update vmcreate1.sh
This commit is contained in:
@@ -10,6 +10,7 @@ show_help()
|
||||
echo "\nIf file not specified, script will use arguments as a list of IP addresses."
|
||||
echo "In this case Hostname will be inherited from 2 last IP octets. Example for 10.10.35.20: 'vm035020'."
|
||||
|
||||
|
||||
# Обрабатываем опции
|
||||
while getopts "a:f:h" opt; do
|
||||
case $opt in
|
||||
@@ -20,10 +21,10 @@ while getopts "a:f:h" opt; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -f $file ]; then echo "File $file does not exist."; exit 1
|
||||
if [ -v $file && ! -f $file ]; then echo "File $file does not exist. Use default 'hosts' file?"; exit 1
|
||||
|
||||
# Если нет аргументов, то создаем временный файл
|
||||
if [ $# -eq 0 ] then
|
||||
# Если заданы аргументы, то создаем временный файл
|
||||
if [ $# -ne 0 ] then
|
||||
touch hosts.tmp
|
||||
for arg in "$@"; do
|
||||
ipcheck "$arg"
|
||||
|
||||
Reference in New Issue
Block a user