Question

I have a Procfile containing:

someprocess: sh -c 'cd /Users/someuser/path/to/sinatra/app && rackup -p 4567'

I need to break this path out so that it is configured via an environmental variable. So I've added this path to my environmental variables stored in a .env file:

SOME_DIR=/Users/someuser/path/to/sinatra/app

and I tell foreman to load these envs when I run it:

$ foreman start -f Procfile.dev -e .env

However, this causes an error as this environmental variable is not available inside the shell command:

someprocess: sh -c SOME_DIR && rackup -p 4567'

Produces an error:

sh: line 0: cd: SOME_DIR: No such file or directory

So how can I pass the environmental variables into the shell command?

Was it helpful?

Solution

I think you are missing $ sign for accessing the variable

cd $SOME_DIR
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top