Linux installation

I have recently installed Suse Linux V8 at home to explore using Radiance in
its "native" environment. Starting with the Desktop Radiance installation
under Windows, I am now reasonably confident in setting up scenes, lights
etc using Cad and a text editor.

I am finding Linux a bit of a challenge. How do I set the RAYPATH
environment variable under the Bourne Again Shell (bash), and how do I set
it as part of my login? I have discovered that if I change to the c-shell
(csh) and follow the installation instructions, it works for that session.
Similarly the animation scripts in the old email archives work under csh,
but not under bash. Should/Can I set Linux to use the c-shell as standard?
Is it worth the bother? Can anyone offer advise on the best way to go, or
refer me to good documentation sites.

Not being familiar with either language, and because of its cross-platform
support, I have been reading up on Perl as an alternative for writing
scripts to use with Radiance. Has anyone used Perl for animations and would
they be willing to share their efforts?

Many thanks

Bruce Sounes

Bruce Sounes wrote:

I am finding Linux a bit of a challenge. How do I set the RAYPATH
environment variable under the Bourne Again Shell (bash), and how do I set
it as part of my login? I have discovered that if I change to the c-shell
(csh) and follow the installation instructions, it works for that session.
Similarly the animation scripts in the old email archives work under csh,
but not under bash.

Add the following line to the file named ".profile" in your
home directory:

export RAYPATH=".:/usr/local/ray/lib"

Of course, you need to adapt the path given to the one where
you actually installed the Radiance library.

Should/Can I set Linux to use the c-shell as standard?

That's primarily a matter of taste. Traditionally, the csh/tcsh
used to be more practical for interactive use, while the sh/bash
was more suited for scripting. But I think those characteristic
differences have become rather blurred over the years.

In any case, it would probably be a good idea to get some kind
of starters guide for unix/Linux, which will answer a whole lot
of similar questions that are bound to come up very soon...

Not being familiar with either language, and because of its cross-platform
support, I have been reading up on Perl as an alternative for writing
scripts to use with Radiance. Has anyone used Perl for animations and would
they be willing to share their efforts?

If you want to get the advantages of Perl without the headaches,
then I'd highly recommend Python instead. There's hardly anything
that you can't do with either of them, just that you'll still
understand your Python programs when you look at them again after
a few weeks, which is not quite as certain with Perl.

Again, however, this is a matter of taste to a certain degree, so
you might want to have a look at both of them, and make up your
own mind.

-schorsch

···

--
Georg Mischler -- simulations developer -- schorsch at schorsch.com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/

Bruce,

Some comments below on your questions.

There are two styles of shells on most UNIX (and Linux) systems: those
derived from the original bourne shell (sh) which include bash, ksh, etc.
and those derived from the C shell (csh, tsch, etc.). The difficulty for
many beginners is that these two families of shells support different
syntax for setting variables in the environment along with different
control flow commands.

Under sh or bash, you set an environment variable as follows:
  RAYPATH=/usr/local/radiance/lib
  export RAYPATH

The first line sets the RAYPATH environment variable only for the current
operating shell. If you start another shell from the current shell, then
the RAYPATH environment variable will not exist. The second line
exports or sets the RAYPATH variable in the environment so it will be
inherited by other shells. These two commands can be combined into a single
line as follows:

  RAYPATH=/usr/local/radiance/lib; export RAYPATH

The semicolon allows multiple commands to issued on the same command line.
NOTE: make sure the RAYPATH environment variable points to where you
actually installed the radiance lib files.

Normally, this command would be placed in the .profile file located in your
home directory. The .profile file is read when the sh, bash, or ksh shell
starts. It acts as an initialization file where you can set all kinds of
environment variables, change behaviors of the shells, etc. The bash shell
will also read a .bshrc resource file in your home directory if it exists.
This .bshrc file is for commands that only the bash shell understands. A
similar .bash_profile file can be used for bash-only startup commands. If
these files don't exist in your home directory, then the system uses some
system-wide files in the /etc (/etc/profile, for example). These system-wide
files should not be changed (except by very experienced administrators).

To set the RAYPATH environment variable and add the radiance bin folder
to your path in your .profile file might look something like the following.
Note comment lines begin with a # character.

# set a RAYPATH if this environment variable does not exist
if [ ${RAYPATH:-""} = "" ] ; then
        RAYPATH=/usr/local/radiance/lib
        export RAYPATH
fi

# add the radiance binaries to the PATH (note we added at front of path)
PATH=/usr/local/radiance/bin:$PATH

# set a MANPATH environment variable if it doesn't exist
if [ ${MANPATH:-""} = "" ] ; then
        MANPATH=/usr/share/man
        export MANPATH
fi

# Add the radiance man pages to the MANPATH
MANPATH=$MANPATH:/usr/local/radiance/man
export MANPATH

If you set these environment variables for bash in the .profile file, then
they will be inherited by any shells that you start (spawn) from this
shell including c shells.

The "set" command will display all of your current environment variables.
You may need to pipe this command through less or more to see all of the
variables if you aren't in anm X window:
  set |less

Note that the SHELL variable is confusing since this variable indicates the
login shell, not the shell that you may be using if you started a csh from
bash.

Now we switch to the C shell side of things. The syntax to set enviroment
variables in the csh (and tcsh) is different. In this case, there is a
single command to set an environment variable.

setenv RAYPATH /usr/local/radiance/lib
setenv PATH /usr/local/radiance/bin:$PATH

The "setenv" command will display the environment variables. These commands
could be placed in a .cshrc file in your home directory that is read
whenever a c shell starts. The .login file is read after the .cshrc file
when this is a login script.

The choice of shells is a personal preference. You will find that most books
on Linux will discuss and provide examples for sh and bash, not csh. So I
would suggest that you stick with bash for the time being. In any case,
you would be better to use tcsh than csh as your csh shell since it
supports a similar syntax for history (executing previous commands again).
Both bash and tcsh support using control-p and control-n or the up-arrow
and down-arrow to move through a list of previous commands. They also
support very similar syntax for editing a previous command line. The
left-arrow and right-arrow move left or right one character at a time,
while the home and end keys move to the beginning or end of the line. The
delete and backspace delete characters from the command line and any
other characters are inserted. Both bash and tcsh support similar syntax
for filename completion.

Once you have logged into Linux you can start another shell easily (just type
csh or tcsh to start a C shell). This new shell will inherit all of the
environment variables from the previous shell

The radiance developers were familiar with the C shell, so the examples that
they provide are written using the C shell syntax.

The command to change your login shell is chsh. If this command is given
by itself, it will prompt you for the shell you which to use for login.
Note that you have to provide the full path to the shell you wish to use.
The following command will list the command shells that Linux knows about
(the command shells listed in /etc/shells):
chsh -l

The chsh program edits the /etc/passwd file in a safe way and changes the
program (command shell) that the operating system runs when you login.

Your choice of scripts for running radiance are a personal preference. Note
that the first line of a shell script file indicates what shell or command is
to execute the commands. Take a look at the rlux or xyzimage shell scripts
located in the radiance bin directory. These scripts begin with the following:

#!/bin/csh -f

This could just as well have been a perl scripti starting with a first line:
#!/usr/bin/perl

Note that shell script files need to be marked as executable (chmod +x) if
you want to be able to just type the shell file name and have them execute.
Otherwise you have to give the name of the file to the shell:
  csh /usr/local/radiance/bin/rlux

I built and installed radiance from the sources, so ignore the locations
in the examples above for where the radiance files are installed. I
customized my installation so all of the radiance files where placed in
directories under /usr/local/radiance. This likely differs from the
location where these files are placed when installing the Linux binaries
downloaded from LBL.

Regards,
-Steve

Bruce Sounes writes:
[ Charset ISO-8859-1 unsupported, converting... ]

I have recently installed Suse Linux V8 at home to explore using Radiance in
its "native" environment. Starting with the Desktop Radiance installation
under Windows, I am now reasonably confident in setting up scenes, lights
etc using Cad and a text editor.

I am finding Linux a bit of a challenge. How do I set the RAYPATH
environment variable under the Bourne Again Shell (bash), and how do I set
it as part of my login? I have discovered that if I change to the c-shell
(csh) and follow the installation instructions, it works for that session.
Similarly the animation scripts in the old email archives work under csh,
but not under bash. Should/Can I set Linux to use the c-shell as standard?
Is it worth the bother? Can anyone offer advise on the best way to go, or
refer me to good documentation sites.

Not being familiar with either language, and because of its cross-platform
support, I have been reading up on Perl as an alternative for writing
scripts to use with Radiance. Has anyone used Perl for animations and would
they be willing to share their efforts?

Many thanks

Bruce Sounes

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Steven Baker Contributing Editor, Unix Review
(541) 683-5927 360 East 15th Avenue
[email protected] Eugene, OR 97401

All programs you run in a Unix session will inherit their environment
variables from the original shell you run, which will (usually) read
.profile (ksh/bash) or .login (tcsh). Hence the suggestion to put the
command in that file. It doesn't always work with GUIs,
though--sometimes the command has to go in some other file. If you
have a computer science background, I refer you to the now 28-year-old
Bell Labs paper on Unix--that will probably fill in some gaps. You
can read it at <http://cm.bell-labs.com/cm/cs/who/dmr/cacm.html>.

Other than that, the c-shell has been mostly superseded by tcsh, which
is available on Linux. There is no need to change your regular shell
to run (t)csh scripts--I've done it--but it's been too long since I
set up Radiance on my Linux box and I don't remember exact details.

Randolph, now sending from BSD Unix via Internet Explorer, Java, and
Mindterm in the Lake Oswego Public Library. It's weird, and if you
know anyone in the Portland, Oregon, USA area who wants to hire
someone with Radiance knowledge, pass along my name. :slight_smile:

···

On Fri, Jul 19, 2002 at 02:28:17PM +0100, Bruce Sounes wrote:

I am finding Linux a bit of a challenge. How do I set the RAYPATH
environment variable under the Bourne Again Shell (bash), and how do I set
it as part of my login? I have discovered that if I change to the c-shell
(csh) and follow the installation instructions, it works for that session.
Similarly the animation scripts in the old email archives work under csh,
but not under bash. Should/Can I set Linux to use the c-shell as standard?
Is it worth the bother? Can anyone offer advise on the best way to go, or
refer me to good documentation sites.