Re: Re: Patch (tiny): \cd (change dir) for psql. - Mailing list pgsql-general

From will trillich
Subject Re: Re: Patch (tiny): \cd (change dir) for psql.
Date
Msg-id 20010329003421.C20318@mail.serensoft.com
Whole thread Raw
In response to RE: Re: Patch (tiny): \cd (change dir) for psql.  (Pruner Jan <pruner@cekia.cz>)
List pgsql-general
On Thu, Mar 29, 2001 at 07:59:01AM +0200, Pruner Jan wrote:
> > You can do this with
> >
> > \!pwd
> >
> > (Of course \!cd won't do what you want.  This situation is
> > similar to an
> > ftp client.)
> >
> > --
> > Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
>
> Why is not possible to run every bash command?
> Something like '\ccd ..' for 'cd ..'  or  '\cpwd'  for 'pwd' etc.

well, the bang-notation is already there: \!ls \!grep \!find
\!who \!last \!pwd

> It's pretty simple.

but it won't work for "cd" ... i know this one!

when a process forks (shield your eyes, everyone, give it some
privacy...) the 'child' inherits the same environment as the
'parent'. but after the fork, each is its own individual process
with its own environment. changing the directory of the parent
won't affect that of the child -- and VICE VERSA as well: namely,
spawning a child shell process, and then changing its default
working directory, will not matter one iota to the parent psql
process.

but you can fork off a quickie 'pwd' which will tell you what its
current directory is -- and given that there's no opportunity to
have it change its directory from the one it inherited from its
parent process, it'll match the 'pwd' of the parent 'psql'
process as well.

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
        -- Isaac Asimov, 'The Genetic Code'

will@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: Pruner Jan
Date:
Subject: RE: Re: Patch (tiny): \cd (change dir) for psql.
Next
From: will trillich
Date:
Subject: Re: timestamp/function question