Update vmcreate1.sh
This commit is contained in:
14
vmcreate1.sh
14
vmcreate1.sh
@@ -21,7 +21,19 @@ while getopts "a:f:h" opt; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -v $file && ! -f $file ]; then echo "File $file does not exist. Use default 'hosts' file?"; exit 1
|
||||
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
|
||||
case $input in
|
||||
y) file=hosts;;
|
||||
Y) file=hosts;;
|
||||
n) read -p "Enter file name: " file;;
|
||||
N) read -p "Enter file name: " file;;
|
||||
*) echo "Use '-f' flag for help"; exit 0;;
|
||||
fi
|
||||
|
||||
if [ $# -ne 0 && -v file ]; then show_help; fi
|
||||
|
||||
# Если заданы аргументы, то создаем временный файл
|
||||
if [ $# -ne 0 ] then
|
||||
|
||||
Reference in New Issue
Block a user