: Hi Andreas, you don't have to use 'exec cd' for Tcl has it's own
: built in 'cd'.
: You just have to do a 'cd /home1'
This won't do it, because my script don't know if the command it has to
execute is 'cd' or anything else.
The user could define his own commands with parameters like
tar cvf #DIR #TARGET
Later he has to substitute #DIR and #TARGET into correct arguments for the
tar command. So far, so good and my script is doing well.
But if the user is defining something like
cd /home1/foo; tar cvf #DIR #TARGET
it wouldn't executed correctly.
In my Script the commandstring which should be executed is stored in a
variable "cmd" and first i execute it using
eval exec $cmd > Output.tmp
Because this don't works correct i use now
set res [eval exec "/bin/csh -c \"$cmd\""]
set fileID [open Output.tmp a+]
puts $fileID $res
close $fileID
As far as i tested it this works fine, but i'm not really happy with this
solution. So, does anybody know a better way to do it?
Thx for any help.
Bye
--
_______________________________________________________________________
| eMail: s_sc...@ira.uka.de oder
Andreas Schwind | un...@rzstud1.rz.uni-karlsruhe.de
| WWW: http://www.uni-karlsruhe.de/~un4w
You're trying too hard -- "cd" is (necessarily) a built-in command,
just do
cd /home1
--
John Haxby
These are my opinions, not my employer's.
You *have* to make a special case of "cd". Suppose you do this:
exec sh -c {cd /home1}
that'll work in the process will complete correctly, but it won't change
the current directory. The current directory is a property of the process,
you can't ask another process to change your directory (well, other than
by editing /dev/mem :-), a process has to change its own directory, that's
why "cd" is necessarily a built-in for anything that allows changing directory
(shells, Tcl, emacs, etc).
Of course, this mostly applies to UNIX, DOS has a different model for the
current working directory.