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 "\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'."
|
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
|
while getopts "a:f:h" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
@@ -20,10 +21,10 @@ while getopts "a:f:h" opt; do
|
|||||||
esac
|
esac
|
||||||
done
|
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
|
touch hosts.tmp
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
ipcheck "$arg"
|
ipcheck "$arg"
|
||||||
|
|||||||
Reference in New Issue
Block a user