Re: .ini files in bash?

2004-11-30 Thread Sam Watkins
On Tue, Nov 30, 2004 at 09:16:07AM +0200, David Baron wrote: Worth a try. Maybe only saving the few I really need will work. As I said, the source line accesses the file but then the script aborts. I was going to write back about this but I thought there were too many suggestions already! Well

Re: .ini files in bash?

2004-11-30 Thread David Baron
On Tuesday 30 November 2004 10:10, Sam Watkins wrote: On Tue, Nov 30, 2004 at 09:16:07AM +0200, David Baron wrote: Worth a try. Maybe only saving the few I really need will work. As I said, the source line accesses the file but then the script aborts. I was going to write back about this

Re: .ini files in bash?

2004-11-29 Thread David Baron
On Monday 29 November 2004 11:24, [EMAIL PROTECTED] wrote: On Mon, 29 Nov 2004 09:24:29 +0200, David Baron [EMAIL PROTECTED] 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? The file name is .bashrc For more

Re: .ini files in bash?

2004-11-29 Thread Robert Vangel
David Baron wrote: Not what I had in mind. I am interested in doing this for a specific bash script without touching .bashrc. Create a seperate rc file (.scriptrc ?) and have FOO=BAR in that, then source the file in your script eg.. [ .scriptrc ] FOO=BAR [ script ] source .scriptrc echo $BAR

Re: .ini files in bash?

2004-11-29 Thread Sam Watkins
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

Re: .ini files in bash?

2004-11-29 Thread David Baron
On Monday 29 November 2004 15:11, [EMAIL PROTECTED] wrote: Create a seperate rc file (.scriptrc ?) and have FOO=BAR in that, then source the file in your script eg.. [ .scriptrc ] FOO=BAR [ script ] source .scriptrc echo $BAR This is what I do once I have the file .scriptrc

Re: .ini files in bash?

2004-11-29 Thread David Baron
On Monday 29 November 2004 16:04, Sam Watkins wrote: 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

Re: .ini files in bash?

2004-11-29 Thread Cameron Hutchison
Once upon a time David Baron said... On Monday 29 November 2004 16:04, Sam Watkins wrote: 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

Re: .ini files in bash?

2004-11-29 Thread Nate Bargmann
* Cameron Hutchison [EMAIL PROTECTED] [2004 Nov 29 15:15 -0600]: Ok. I got bored and spend a minute writing this: function savevars() { for var in $@ ; do eval echo $var=$$var\\\ done } Just call it like: savevars VAR1 VAR2 VAR3 file then load the vars with:

Re: .ini files in bash?

2004-11-29 Thread Cameron Hutchison
Once upon a time Nate Bargmann said... * Cameron Hutchison [EMAIL PROTECTED] [2004 Nov 29 15:15 -0600]: Ok. I got bored and spend a minute writing this: function savevars() { for var in $@ ; do eval echo $var=$$var\\\ done } Just call it like:

Re: .ini files in bash?

2004-11-29 Thread Cameron Hutchison
Once upon a time Cameron Hutchison said... I was working on a proper solution, but put it aside when I got to nine consecutive backslashes in a sed expression. Replying to my own posts - a sign of madness. A further sign is that I think I've got a function that will do it properly. I didn't

Re: .ini files in bash?

2004-11-29 Thread Cameron Hutchison
Once upon a time Cameron Hutchison said... function savevars() { for var in $@ ; do eval echo $var='$(echo $'$var' | sed -e s/'\''/'\'''\'\''/g -e s/^/'\''/ -e s/$/'\''/ )' done } That doesn't work properly either. Newlines in a variable are not handled properly.

Re: .ini files in bash?

2004-11-29 Thread Miquel van Smoorenburg
In article [EMAIL PROTECTED], David Baron [EMAIL PROTECTED] 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? Okay so everybody's trying to outdo eachother trying to write sed scripts that do proper quoting. I'd

Re: .ini files in bash?

2004-11-29 Thread Cameron Hutchison
Once upon a time Miquel van Smoorenburg said... In article [EMAIL PROTECTED], David Baron [EMAIL PROTECTED] 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? Okay so everybody's trying to outdo eachother

Re: .ini files in bash?

2004-11-29 Thread Kevin Mark
On Mon, Nov 29, 2004 at 04:02:15PM +0200, David Baron wrote: On Monday 29 November 2004 15:11, [EMAIL PROTECTED] wrote: Create a seperate rc file (.scriptrc ?) and have FOO=BAR in that, then source the file in your script eg.. [ .scriptrc ] FOO=BAR [ script ] source

Re: .ini files in bash?

2004-11-29 Thread David Baron
On Tuesday 30 November 2004 00:02, [EMAIL PROTECTED] wrote: function savevars() { for var in $@ ; do eval echo $var=$$var\\\ done } Just call it like: savevars VAR1 VAR2 VAR3 file then load the vars with: source ./file Worth a try. Maybe only saving the few I really need

.ini files in bash?

2004-11-28 Thread David Baron
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? -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]

Re: .ini files in bash?

2004-11-28 Thread Kamaraju Kusumanchi
On Mon, 29 Nov 2004 09:24:29 +0200, David Baron [EMAIL PROTECTED] 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? The file name is .bashrc For more information install bash-doc package and read the bash