Subject: Re: basic shell questions
To: None <port-alpha@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: port-alpha
Date: 06/08/2001 01:18:57
In article <l03130329b745bd78ed1c@[130.102.20.138]>,
Ray Phillips <r.phillips@mailbox.uq.edu.au> wrote:
>Dear NetBSD/alpha:
>
>I'm a little embarrased to ask these questions, but could you oblige me,
>please?  (I'm using NetBSD/alpha 1.5.)
>
>1) What's the best way of modifying the default path for all non-root users
>whose
>   default shell is csh?  My current solution is to use
>
>       setenv PATH ${PATH}:/extra/seach/path

That is fine. You should really be using:
	set path=($path /foo /bar)
because older versions of csh did not mirror shell and environment variables
properly. Shell variables [the ones that the shell only sees] are set using:

	set var=value

environment variables are set using:

	setenv VAR value

Some shell variables in csh are mirrored automatically with the environment,
for user convenience. For example TERM and PATH are automatically mirrored,
so:
	set term=foo

does an implicit:

	setenv TERM foo

and vice-versa. Environment variables are seen by programs that are running
under that shell, regular shell variables are not.

>
>   in /etc/csh.cshrc which works, but I wonder if there's a
>better/preferred method.

If you want to affect all users, this is the best method.

>2) What's the difference between using "setenv" and "set" in .cshrc.  Both
>are used
>   in /root/.cshrc.  I've found that in ~/.cshrc
>
>       setenv http_proxy http://autoproxy.jkmrc.uq.edu.au:3128

read above.

>   works but not
>
>       set http_proxy http://autoproxy.jkmrc.uq.edu.au:3128
>
>   which produces a syntax error.
>
>   However, both
>
>       setenv PAGER less
>
>   and
>       set PAGER less
>
>   seem to work.

I do not believe that. Try:

	unsetenv PAGER
	set PAGER less
>3) What's the cdpath environment variable in /root/.cshrc used for?

It is a path, that the cd command looks up to change directories.
So if you:

	set cdpath=(/usr/src)

then

	cd usr.sbin

from any location, will first check if there is a "usr.sbin" under the
current working directory and then look at the list of paths in $cdpath 
to find a path that exists and chdir() to it.

>4) What's the shell variable BLOCKSIZE (which is set to 1k in both
>/root/.cshrc and
>   /root/.profile) use for?

This is used by some programs (du, df) come to mind, possibly others
to change the unit they display values by default. Historically unix
commands display values in units of 1 unix block which is 513 bytes.
It is more useful to display values in units of 1K that is why
BLOCKSIZE is set.

christos