I am trying to make a simple script to swap between my server and main computer to compile nginx, but everytime I run the script, it ignores the first variable in $nginxsrc which is $code. I stripped the build stuff out, because its not relevant to the question.
#!/bin/bash
home="/home/michael"
code="/src/nginx"
NGINX="nginx-1.13.11"
nginxsrc="$code/$NGINX"
echo "$code"
echo "$NGINX"
echo "$nginxsrc"
Here is what happens when it runs:
$ sudo bash /usr/local/bin/build-nginx
/src/nginx
nginx-1.13.11
/nginx-1.13.11
I have tried putting them in {} like so: nginxsrc="${code}/${NGINX}"
I have tried with and without quotes: nginxsrc=$code/$NGINX
My server is running ubuntu 16.04.4 LTS 64-bit with all the latest updates.
Bash version is 4.3.48
Obviously the expected result is:
/src/nginx
nginx-1.13.11
/src/nginx/nginx-1.13.11
codevalue and then to display the value ofnginxsrcusingecho -e.