Subject: Re: basic shell questions
To: Ray Phillips <email@example.com>
From: Ken Wellsch <firstname.lastname@example.org>
Date: 06/07/2001 21:22:24
Ray Phillips wrote:
> 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
> works but not
> set http_proxy http://autoproxy.jkmrc.uq.edu.au:3128
> which produces a syntax error.
> However, both
> setenv PAGER less
> set PAGER less
> seem to work.
"setenv" is used to set what are called environment variables under csh.
Those variables are inherited by all processes created from that shell
and unless changed again, all sub processes of those and so on...
While "set" is for setting a local variable to that specific csh instance.
Oh I think there are icky kludges like "set path" gets exported, but
basically that is what that is about.
Also, just to keep you confused, the "setenv" syntax is different from
the "set" syntax.
You do "set a=value" while "setenv a value"
So your line "set PAGER less" sets two local variables to empty strings.
(because you can say "set a=value b=value c=value" on a single line)
Checkout the "printenv" or "env" command to dump environment variables,
and "set" to list local variables.
> 3) What's the cdpath environment variable in /root/.cshrc used for?
It is a search path for "chdir" or "cd" - like the command search path.
So when you give a relative path element, e.g. "cd csh" you may find
yourself jumping over to /usr/src/bin/csh.
> 4) What's the shell variable BLOCKSIZE (which is set to 1k in both
> /root/.cshrc and
> /root/.profile) use for?
It is used for commands like "df" to select what size to use, e.g.
BLOCKSIZE of "1k" will cause "df" to show disk size values in kilobytes
rather than the old traditional "block size" of a disk sector of 512 bytes.