diff --git a/vmcreate1.sh b/vmcreate1.sh index 0d32c6e..5756054 100644 --- a/vmcreate1.sh +++ b/vmcreate1.sh @@ -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