(1) cd is a basic tcl command, so you should be able to just do
cd $dir
(2) alternatively, use the fully qualified pathname to cd; it apparently
isn't in your path; for example,
set path <whatever it is>
exec cd $path/cd $dir
|> ---
|> S.Jagadish : SF91...@NTUVAX.NTU.AC.SG
|>
|> Nanyang Technological University Singapore
|> Die hard Kamal Hassan visiri ... from Kalatthur Kannama to Kurudhi Punal !!
|> Mayajaal : http://www2.ntu.ac.sg:8000/~sf918168/mayajaal.html
|> OR http://155.69.1.17:8000/~sf918168/mayajaal.html
|>
|> "Api Swarnamayii Lanka, Na Me Lakshmane Rochate" - Ramayana
---
uhh... many systems (e.g. UNIX) have no executable
change directory command. it just wouldn't work,
it has to be a built-in.
(there -is- one on AmigaDOS, but it's an unusual beast.)
--
Hume Smith <hcls...@isisnet.com> NetBSD r00lz :)
"Honesty always give you the advantage of surprise
in the House of Commons." - Yes Minister
Note that the error received was that the user's system doesn't have a command
called cd to be exec'd. In many/most cases for Unix, cd is built into a
shell and so one cannot do an exec. Which is just as well, because by doing
an exec cd you don't gain any benefit anyways - the cd would have been done
in the child executed and once it completed, the child would die and the
parent would still be in the same directory.
The bottom line is, option 1 above is the only one viable for Tcl code
writing.
--
:s Larry W. Virden INET: lvi...@cas.org
:s <URL:http://www.teraform.com/%7Elvirden/> <*>
:s Unless explicitly stated to the contrary, nothing in this posting should
:s be construed as representing my employer's opinions.
cd is a builtin in tclsh/wish (and every other shell that ever
existed) so you shouldn't bother with the exec, as even if it worked,
it wouldn't (talk to your local UNIX guru about this if you can't
figure out why this has to be the case, as the explanation has nothing
to do with tcl)
Donal.
--
Donal K. Fellows, (at work) | Donal K. Fellows, (at home)
Dept. of Computer Science, | 6, Randall Place, Heaton,
University of Manchester | Bradford, BD9 4AE
U.K. Tel: ++44-161-275-6137 | U.K. Tel: ++44-1274-401017
fell...@cs.man.ac.uk (preferred) | do...@ugglan.demon.co.uk (if you must)
-------------------------------------------------------------------------------
<http://r8h.cs.man.ac.uk:8000/> for my home page
>(2) alternatively, use the fully qualified pathname to cd; it apparently
>isn't in your path; for example,
>
> set path <whatever it is>
> exec cd $path/cd $dir
In V6, I think, cd wasn't a shell built-in, but even then it was especially
recognised by the shell. The trouble is that the chdir() system call, which
cd invokes, changes the working directory of the current process. This means
that "exec cd $dir" would do nothing useful. "cd" *has* to be a built-in or
at least especially recognised.
--
John Haxby
These are my opinions, not my employer's.
And many people have told me that, too! :-)
Another "Mosley response whithout a great deal ot thought"!