Re: Re: Patch (tiny): \cd (change dir) for psql.

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Patch (tiny): \cd (change dir) for psql.
Date: 2001-03-29 06:34:21
Message-ID: 20010329003421.C20318@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)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(at)serensoft(dot)com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2001-03-29 06:38:41 tables, where
Previous Message Peter Coppens 2001-03-29 06:24:02 Postinstall: libxcurses not found