Bob not using .env file ? #400
-
|
Trying to write a script on IBM i that compiles my sources (similar to VSC) I noticed that Bob is not reading the .env file ? I know the file is excluded from Git (which is fine) so I created a specific one on my IBM i with a specific TGTLIB setting, but executing makei compile -f test.pgm.rpgle causes the command to fail with the following trace I figured out that I could fix this by first doing an EXPORT TGTLIB=MYLIB or specifying -e TGTLIB=MYLIB on the makei command but this is cumbersome (especially since on VSC it is handled fine by having the .env file) Is this a bug or Is there a reason Bob is not reading the .env or is there a method to make my shell script behave the same as pressing CTRL-SHIFT-C (or B) in VSC ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
If I'm not mistaken, Bob does not automatically load environment variables from the
#!/bin/bash
# Load environment variables from .env file
set -a
source .env
set +a
# Run compile command with the provided file argument
makei compile -f "$1"
|
Beta Was this translation helpful? Give feedback.
-
|
Sanjula, you are correct. We do not do any special processing on .env in BOB. This does work in project-explorer in VS Code with the Code for IBM i deploy. |
Beta Was this translation helpful? Give feedback.

If I'm not mistaken, Bob does not automatically load environment variables from the
.envfile (@edmundreinhardt please correct me if this is incorrect. Maybe an enhancement could be to have an option to point to a.envfile). The reason it works in VSC, is because Code for IBM i loads these environment variables for you before running the build or compile command. As you found out, you can specify env vars by exporting them or by specifying them on the command itself. If you are using a shell script, you can do something like this:myScript.sh: