From: | "Brendan Jurd" <direvus(at)gmail(dot)com> |
---|---|
To: | "Jerry Sievers" <jerry(at)jerrysievers(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: psql: present working directory |
Date: | 2006-11-20 14:45:22 |
Message-ID: | 37ed240d0611200645l5b70c8ddw5fb735e0d35a7b22@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 20 Nov 2006 08:24:48 -0500, Jerry Sievers <jerry(at)jerrysievers(dot)com> wrote:
> "Brendan Jurd" <direvus(at)gmail(dot)com> writes:
> > Is there any interest in having a backslash command to psql that
> > prints the current working directory? This would nicely complement
> > the functionality offered by \cd.
>
> We have this through subshell invocation
>
> \!pwd
>
> HTH
Yep, that does the trick, and it is convenient.
I had a look at what \cd currently does if you give it no arguments.
I expected it to do nothing at all (since there is no output), but see
src/bin/psql/command.c lines 266 - 285. Under win32 the working
directory is set to "/", on other systems it is set to the value of
the current user's home directory.
The intent seems to be to mimic the behaviour of "cd" at the shell.
Under Linux (at least), "cd" with no arguments at the shell does
indeed change to your home directory. Personally I think printing out
the current directory would make more sense in the psql context, but
mimicking the shell certainly has value.
Maybe psql should print a line saying "Current directory was set to
'/home/you'." in this case?
Comments in the code point out that "cd" without arguments under
Windows normally prints out the current directory, so the chdir to "/"
isn't ideal, and would probably be trivial to change to mimic the
Windows command line behaviour.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-11-20 15:01:45 | Re: [HACKERS] Replication documentation addition |
Previous Message | Teodor Sigaev | 2006-11-20 14:20:36 | Re: Tsearch + polish ispell + polish locale |