Unix Shell - setenv does not work

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > February 2007 > setenv does not work





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author setenv does not work
Schubert

2007-02-22, 7:15 pm

Hi guys,

I want to use setenv command to add the path "/usr/ucb" to the $PATH,
but the system says "setenv: not found". I use "echo $PATH" , only see
"/usr/bin" is in $PATH. How can I add the path to $PATH? I am using
SunOS 5.9. I know it is an old system, but I have no other options.
Anyone has some ideas?

Thanks

OldSchool

2007-02-22, 7:15 pm

On Feb 22, 2:36 pm, "Schubert" <cxbest2...@yahoo.com> wrote:
> Hi guys,
>
> I want to use setenv command to add the path "/usr/ucb" to the $PATH,
> but the system says "setenv: not found". I use "echo $PATH" , only see
> "/usr/bin" is in $PATH. How can I add the path to $PATH? I am using
> SunOS 5.9. I know it is an old system, but I have no other options.
> Anyone has some ideas?
>
> Thanks


depends on which shell you are using. "setenv" applies to c-shell.

try:

PATH=$PATH:/usr/ucb

Schubert

2007-02-22, 7:15 pm

Thank you Old School (not sure if it is your real name). It works.
Do you know how can I ensure which shell I am using?

Schubert

On Feb 22, 2:57 pm, "OldSchool" <scott.my...@fds.com> wrote:
> On Feb 22, 2:36 pm, "Schubert" <cxbest2...@yahoo.com> wrote:
>
>
>
>
> depends on which shell you are using. "setenv" applies to c-shell.
>
> try:
>
> PATH=$PATH:/usr/ucb



Bit Twister

2007-02-22, 7:15 pm

On 22 Feb 2007 12:01:24 -0800, Schubert wrote:
> Thank you Old School (not sure if it is your real name). It works.
> Do you know how can I ensure which shell I am using?


Does basename $SHELL
tell you anything

Schubert

2007-02-22, 7:15 pm

On Feb 22, 3:03 pm, Bit Twister <BitTwis...@mouse-potato.com> wrote:
> On 22 Feb 2007 12:01:24 -0800, Schubert wrote:
>
>
> Does basename $SHELL
> tell you anything


It shows "sh" only. Don't know what kind of shell it is.

Bit Twister

2007-02-22, 7:15 pm

On 22 Feb 2007 12:15:37 -0800, Schubert wrote:
>
> It shows "sh" only. Don't know what kind of shell it is.


That would be your shell and you might consider doing a
export PATH
on the line after your PATH= line.


Looking at mine, we see
$ basename $SHELL
bash
Michael Tosch

2007-02-22, 7:15 pm

Bit Twister wrote:
> On 22 Feb 2007 12:15:37 -0800, Schubert wrote:
>
> That would be your shell and you might consider doing a
> export PATH
> on the line after your PATH= line.
>
>
> Looking at mine, we see
> $ basename $SHELL
> bash


I bet this works in *every* shell:

\test -n "$shell" && goto csh
PATH=${PATH}:/usr/ucb
export PATH
read dummy << \:
csh:
setenv PATH ${PATH}:/usr/ucb
:


--
Michael Tosch @ hp : com
Icarus Sparry

2007-02-22, 7:15 pm

On Thu, 22 Feb 2007 21:52:36 +0100, Michael Tosch wrote:

> \test -n "$shell" && goto csh
> PATH=${PATH}:/usr/ucb
> export PATH
> read dummy << \:
> csh:
> setenv PATH ${PATH}:/usr/ucb


Fails badly for 'rc'. Double quote is not a special character to rc.
Backslash is only special before a newline.
$shell is not set and I don't have an external command 'goto' these days.
{} are special
There is no 'export' - all variables are exported.
The here document is unterminated....

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com