Re: Environment variables

From: Bruno LEVEQUE <bruno(dot)leveque(at)net6d(dot)com>
To: Roy MacGregor Paterson <roy(at)macgregortech(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Environment variables
Date: 2003-11-22 07:23:35
Message-ID: 3FBF0EF7.6090402@net6d.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)leveque(at)net6d(dot)com
http://www.net6d.com

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Marcus Andree S. Magalhaes 2003-11-22 07:30:27 postgresql x sap db
Previous Message Roy MacGregor Paterson 2003-11-22 01:00:47 Environment variables