I'm trying to create a variable in a bash script and the first space is causing issues.
The variable looks something like this:
VAR="
--option1=foo \
--option2=bar \
--option3='something here with spaces'"
I'm trying to run a "make install" and it always complains about the first space (ie. before the word "here" in the above example).
How do I create a variable with spaces? I tried using double-quotes, various attempts at escaping the single-quotes, and I can't get anything to work.
What am I doing wrong?
Actual code below:
NGINX_OPTIONS="
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-ld-opt='-ljemalloc -Wl,-z,relro -Wl,-rpath,/usr/local/lib -Wl,--as-needed -pie' \
--with-cc-opt='-m64 -march=native -DTCP_FASTOPEN=23 -g -O3 -Wno-error=strict-aliasing -fstack-protector-strong -flto -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -gsplit-dwarf'"
NGINX_MODULES="
--with-compat \
--with-threads \
--with-file-aio \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_mp4_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_sub_module \
--with-mail \
--with-mail_ssl_module \
--with-stream \
--with-stream_realip_module \
--with-stream_ssl_module \
--with-stream_ssl_preread_module"
./configure $NGINX_OPTIONS $NGINX_MODULES
make
make install