Re: Environment variables - Mailing list pgsql-novice

From Bruno LEVEQUE
Subject Re: Environment variables
Date
Msg-id 3FBF0EF7.6090402@net6d.com
Whole thread Raw
In response to Environment variables  (Roy MacGregor Paterson <roy@macgregortech.com>)
Responses Re: Environment variables
List pgsql-novice
Hi Roy,


Roy MacGregor Paterson wrote:

> Thanks to Michael Grant for getting me started (previous question).
>
> Here's the conceptual pothole I'm currently in...
>
> I want to set up the PATH variable for psql. I might even understand why.
>
> I've got a .tcshrc file in my home directory.
>
> I know how to modify the .tcshrc file to include the relevant line...
> "setenv PATH /usr/local/psql/bin"
>
> However, .tcshrc already has a PATH variable which I don't want to
> lose...
> "setenv PATH "$PATH":/Library/MySQL/bin"
>
> So, can I just add the new line to the file? If so, how do psql and
> MySQL know which is which, given that they have the same name?
>

In the below line you have in logical write : PATH=PATH+/Library/MySQL/bin

So if you add another line like : setenv PATH "$PATH":/usr/local/psql/bin
You'll take what you want. ie (in logical write)
PATH=PATH+/usr/local/psql/bin
or, if we look the contain of PATH (in logical write)

PATH=/bin+/sbin+/usr/bin+/usr/sbin+/Library/MySQL/bin+/usr/local/psql/bin

It's what you want


> Or, are they mutually incompatible - I can have one or the other but
> not both?
>
> Or, are multiple PATH variables traversed until something makes sense
> to whatever it is that reads them?
>
> In my csh.login file I have the following PATH variable...
> "setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin""
>
> ...and if I execute the terminal command "echo $PATH" I get...
> "/bin:/sbin:/usr/bin:/usr/sbin:/Library/MySQL/bin"
>
> ...from this I deduce that I may be able to concatenate the paths in
> .tcshrc into something like...
> "setenv PATH "$PATH":/Library/MySQL/bin:/usr/local/psql/bin"
> ...is this correct?
>
Yes

> Why is the syntax of these PATH variables different anyway? Is this
> something specific to each of those programs or does
> csh/tcsh/unix/macos allow two different syntaxes (syntaxi?) for the
> setenv command (i.e. is setenv an attribute of tcsh or of psql and
> MySQL)?
>
setenv is a (t)csh command.

In you csh.login you have a minimal value
(/bin:/sbin:/usr/bin:/usr/sbin). Just where to find system commands, and
in your .tcshrc you have an "user" value. Like this each user can take a
different PATH.

> Yup, I don't have the O'Reilly book "csh and tcsh". It's nearly 1am in
> London and the shops are closed. As ever, the two books that I do have
> are telling me just enough to get me into trouble and not enough to
> get me out again.
>
> What websites should I be looking at to answer these kind of questions
> without flashing the cash? Apple.com Support just shrugs when I enter
> tcsh as a query.


Sorry, I don't know

> TIA
> Roy


Bruno

--
Bruno LEVEQUE
System Engineer
SARL NET6D
bruno.leveque@net6d.com
http://www.net6d.com



pgsql-novice by date:

Previous
From: "Marcus Andree S. Magalhaes"
Date:
Subject: postgresql x sap db
Next
From: Roy MacGregor Paterson
Date:
Subject: Re: Environment variables