Update vmcreate1.sh
This commit is contained in:
@@ -33,6 +33,7 @@ if [[ $# -eq 0 && -v $file && ! -f $file ]]; then
|
||||
N) read -p "Enter file name: " file;;
|
||||
*) echo "Use '-f' flag for help"; exit 0;;
|
||||
esac
|
||||
if [ ! -f hosts ]; then echo "File 'hosts' does not exist. Exiting."; exit 0; fi
|
||||
fi
|
||||
|
||||
# Если заданы аргументы И файл
|
||||
@@ -46,7 +47,10 @@ if [ $# -ne 0 ] then
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo -n "$arg " >> ./hosts.tmp
|
||||
echo hostname_generate $arg >> hosts.tmp
|
||||
echo -n "vm" >> ./hosts.tmp
|
||||
printf "%05d\n" "$(echo -n $arg | cut -d '.' -f 3)" >> ./hosts.tmp
|
||||
printf "%05d\n" "$(echo -n $arg | cut -d '.' -f 4)" >> ./hosts.tmp
|
||||
echo >> ./hosts.tmp
|
||||
else
|
||||
echo "Argument $arg is not valid IP address (10.10.*.*). Using next argument."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user