[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"set"-output cannot be reread
From: |
Wolfgang Schludi |
Subject: |
"set"-output cannot be reread |
Date: |
10 Jul 2001 11:56:08 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386'
-DCONF_OSTYPE='linux' -DCONF_MACHTYPE='i386-suse-linux' -DCONF_VENDOR='suse'
-DSHELL -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -I. -I/usr/include -I.
-I./include -I./lib -I/usr/include -O2 -m486 -D_GNU_SOURCE -Wall -pipe
uname output: Linux tristan 2.2.16 #3 SMP Sat Sep 2 14:25:00 MEST 2000 i686
unknown
Machine Type: i386-suse-linux
Bash Version: 2.04
Patch Level: 0
Release Status: release
Description:
the bash manual says:
: [...]
: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
: Without options, the name and value of each shell
: variable are displayed in a format that can be
: reused as input. [...]
I understood this to mean, that I can redirect the output from
"set" into a file and later I can source that file with ".".
But it seems, that the output of functions is not compatible for
reuse. They look like declarations of empty arrays, followed by
code between "{" and "}", that is immediately executed.
Repeat-By:
f() { echo function; }
set > /tmp/set.test
. /tmp/set.test
Fix:
no fix.
But maybe I'm trying to solve my problem with the wrong
tool/way. "typeset" seems to be worse, since it doesn't quote values
that contain whitespace. Similar for "env".
What I'm aiming for is:
save the state/environment of the current session/shell in a file and
use that file in a different shell as input to get a similar
environment
I know that it's not possible to get exactly the same environment
(readonly-vars, $$, etc.). But if the output from "set" could be used
as shell-script for "." that would do it for me.
any suggestions?
regards,
schludi
- "set"-output cannot be reread,
Wolfgang Schludi <=