1

I have the following bash script snippet that switches to the node user and uses heredoc syntax to run a series of commands which is required. How can I share the variable $APP_VERSION into the node user? Currently $APP_VERSION is showing undefined when printed. I thought exporting it would work, but seems not.

#!/usr/bin/env bash set -eo pipefail; [[ $TRACE ]] && set -x export APP_VERSION=1.4.5 sudo su node <<'EOF' printf "APP VERSION IS: %s" "$APP_VERSION" node app.$APP_VERSION.js EOF 
0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.