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
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
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
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
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
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
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
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
* 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:
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:
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
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.
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
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
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
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
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]
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
18 matches
Mail list logo