1

I've the this bash file that I need to export two variables SDK_PATH and BIN_PATH so to not worry exporting them anymore I added them in the ~/.bashrc file but when I run the bash it prompts me that I still need to export the variables even though I'm able to echo them in the terminal. How do I make them to be exported automatically?

I declared the variables in the ~/.bashrc file as follows:

SDK_PATH=~/SDKs/ESP8266_RTOS_SDK
BIN_PATH=./bin/
  • How did you define them in ~/.bashrc? – heemayl Jan 8 '17 at 5:29
  • 1
    Thank you heemayl for the quick reply, I added the declaration in the OP – Rinaldi Segecin Jan 8 '17 at 5:31
3

You need to export the variable definitions in ~/.bashrc too, otherwise they won't be propagated to the child processes of the interactive shell session (that source-s the ~/.bashrc file). Do:

export SDK_PATH=~/SDKs/ESP8266_RTOS_SDK
export BIN_PATH=./bin/
0

Now add this two line

  export SDK_PATH
  export BIN_PATH
  • In bash it is cleaner to do it at the same time you're assigning the variable. An export by itself would be needed for Bourne shell or other ancient shells. – chicks Jan 8 '17 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.