mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 03:32:12 +00:00
bash speed matching the regex behavior of Ansible
This commit is contained in:
parent
52900ba330
commit
3afc93b5ae
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
handle1=$(grep "^openvpn_handle:" /etc/iiab/local_vars.yml | sed -e "s/^openvpn_handle://; s/^\s*//; s/\s*$//" | cut -d'"' -f2 | cut -d"'" -f2)
|
||||
handle1=$(grep "^openvpn_handle:" /etc/iiab/local_vars.yml | sed "s/^openvpn_handle:\s*\(['\"]\)\(.*\)\1\s*$/\2/")
|
||||
echo -e "\n/etc/iiab/local_vars.yml source/master copy: $handle1"
|
||||
if [ -f /etc/iiab/openvpn_handle ]; then
|
||||
handle2=$(cat /etc/iiab/openvpn_handle)
|
||||
|
@ -11,6 +11,7 @@ fi
|
|||
|
||||
echo -en "\e[1mPlease type a descriptive OpenVPN machine name (openvpn_handle) such as:\n\n cape-town-school-36-rpi-2019-05-31\n\nOr hit [Enter] to keep the existing name:\e[0m "
|
||||
read ans < /dev/tty
|
||||
ans=$(echo $ans | sed "s/^\s*\(['\"]\)\(.*\)\1\s*$/\2/")
|
||||
|
||||
#if [ "$ans" != "" ] || ( [ "$handle1" = "" ] && [ ! -f /etc/iiab/openvpn_handle ] ); then
|
||||
if [ "$ans" != "" ] || ( [ "$handle1" = "" ] && [ ! -v handle2 ] ); then # equivalent to above
|
||||
|
|
Loading…
Reference in a new issue