[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: .ini files in bash?



On Mon, Nov 29, 2004 at 09:24:29AM +0200, David Baron wrote:
> How might one save and restore setting of variables in a bash script to and 
> from a file in one's home (or sub-) directory?

If you want to see what variables are set, type:

  set

this shows shell functions too.

you can save these variables (and possibly functions) in a file:

  set > myvariables

and restore them again:

  source ./myvariables

or if you're lazy to type source:

  . ./myvariables


the "./" is important, if you give source a pathname without a / in it, it
looks for files using $PATH first, then if that fails it looks in the current
directory.  For example if you have a file called "test" and type:

  source test


it will try to source /usr/bin/test, and say:

  bash: ELF: command not found

This seems like ++bogus behaviour to me,
but there may be some good reason for it.



Sam



Reply to: