Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Engineer
    Join Date
    Jan 2005
    Chicago (USA)

    Evil environment variables

    Whenever I set a custom environment variable in Bash, it doesn't exist when I exit the shell. I've tried just EXTRACT_DIRECTORY=/home/notroot/sources, set, export, typeset, declare (-x) and editing ~/.bashrc and ~/.bash_profile.

  2. #2
    Linux Engineer
    Join Date
    Nov 2004
    If you set a variable, it will only last until that shell is exited. If you want to keep it, the best thing (if you're using bash) is to export it in you ~/.bashrc:

    export MONKEY="cheese and cucumbers"

    .bashrc is sourced whenever a bash shell is started, so the export will happen and the variable will be defined.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts