Create openvpn client ovnp file script help

iv been working on combining these two scripts:

into this:

cd /etc/openvpn

read -p "please enter the user name for the new file: " USER

[ -z ${USER} ] && { echo “cannot be empty”; exit 1; }
[ -f keys/${USER}.crt ] && { echo “Certificate keys/${USER}.crt already exists”; exit 2; }

source ./vars
./build-key ${USER}

cd /etc/openvpn/keys


cat config.ovpn.tpl

echo ‘’
cat ${USER}.key
echo ‘’

echo ‘’
cat ${USER}.crt
echo ‘’

echo ‘’
cat ${USER}.crt
echo ‘’

) > openvpn_${USER}.ovpn

sleep 5

src = “openvpn_${USER}.ovpn”
$1 = $src
dst = “$(basename $src .ovpn)_packed.ovpn”

gawk -f - $src > $dst << ‘AWK’
function readcert(file) {
while ((getline < file) > 0) {
contents = contents RT $0
if ($1 == “-----BEGIN”)
contents = $0
if ($1 == “-----END”)
return contents
$1 ~ /^(ca|key|cert)$/ {
tag = $1
print “#” $0
print “<” tag “>”
print readcert($2)
print “</” tag “>”

but i cant get past this: image

can someone please make me look like an idiot and point out the issue, i don’t do this as often as some of you might

take your spaces out of line 36 so your src is used. its not understanding you there and as its not a var its failing after.

Edit: maybe its 35, not sure, its the scr = that is an issue, it should be scr=whatever

still unhappy with it, thinks its a command when its not…i fixws the config.ovpn.tpl was in wrong spot

getting better

not sure what your current line 37 looks like, please post that and the chunk around it. also it would be faster to ctrl+shift+C copy your output from terminal

looks like a space is messing you up from the output.

iv gone to deep to have a working clipboard and until i get the tunnel working im not enabling ssh

however this seems to have done it, i realized that the second half is redundant but it never executed anyways but this has the corrections needed to work thanks for the help!

Awesome, glad it works