LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Saving User-Created Variables (https://www.linuxquestions.org/questions/programming-9/saving-user-created-variables-146473/)

feetyouwell 02-15-2004 04:52 PM

Saving User-Created Variables
 
which conf file do i edit to save User-Created Variables ?

Tinkster 02-15-2004 06:27 PM

Bash, C, C++, Perl, ... ?
Persistent Objects?


Cheers,
Tink

feetyouwell 02-15-2004 07:45 PM

bash!

Tinkster 02-15-2004 09:56 PM

I don't think that there is a "config file" you can
edit to achieve automatic saving of environment
variables. The user would have to actively put
the variables he needs preserved into either
.bashrc or ./bash_profile (depends on how you
invoke bash, "man bash" for details) to have
them "preserved" between sessions.


If you want to have a bash-script get specific
variables between sessions, write & read them
to/from files.


Code:

my_exit()
{
  echo $MY_VAR_1 > ~/.my_var_1
  exit
}

my_init()
{
  export MY_VAR_1=`cat ~/.my_var_1`
}

and so forth ...


Cheers,
Tink


All times are GMT -5. The time now is 11:12 AM.