[Radiance-general] RADIANCE and Unix shells

Thomas Bleicher tbleicher at arcor.de
Thu Sep 29 23:10:05 CEST 2005


On 29.09.2005, at 19:19, Kirk Thibault wrote:

> I am fairly new to unix usage, so i have not developed a preference  
> for a particular flavor of shell.  As I am now beginning to  
> experiment with more shell programming, the question is, are there  
> particular aspects of RADIANCE that make programming it in a  
> particular shell more advantageous to others?
>
> I was using tcsh (the Mac OSX former default) but am at the point  
> where I want to explore other options.

Rather than focusing on Radiance you should consider your primary
environment and day to day tasks to define your shell of choice:

sh -   plain old shell
        most portable across platforms/shells but not much features

bash - very popular on (and because of) Linux
        most Linux sysadmin scripts around are for bash
        most scripts around are in bad style but nobody knows better
        environment often highly customized in current distributions
        (makes it harder to learn plain bash)

csh -  traditional shell for most Unix flavours
        C-like syntax (if that's any help to learn it)
        in older incarnations harder to use because it's
        missing bash-like usability "enhancements"
        probably most compatible across platforms ("already installed")
        Radiance ships with some scripts in csh

tcsh - better to use but still compatible to csh

zsh -  very powerfull shell
        not much in use, though (read: not much examples around)

ksh -  default shell on AIX systems
        little used elsewhere


I started out with bash but never bothered to do real script
programming because I tend to use Python for anything that
requires more than 5 lines of code. I don't think any of these
shells is particularly good for Radiance because they all
provide the basic shell environment which makes Radiance
so flexible (pipes, redirection, filter etc.).

If you want to create scripts that should be used by more than
one person keep them well documented. Anyone knowing anything
about shell scripting should then be able to understand what
you are doing. If you want to share your scripts as well you
should try to aim for POSIX compliance and avoid shell typical
enhancements. This will help others to reuse your scripts on
other platforms/shells/implementations of your shell.

Knowing a bit about *sh is essential to get anything done but
even small tasks may be worth a "proper" programming language:

1) For more complicated things (name rewriting etc.) you will
    have to use sed/awk/perl (that's the unix way to do things)
    more sooner than later. So you'll have to know their syntax
    as well and your co-admins will have to know them, too.

2) Python/Ruby/TCL/Perl(!) are better to understand for non-gurus
    than esoteric shell constructions are. (Readability does not
    depend on the language but on your style, though).

3) Perl, TCL and Python are available on nearly all platforms
    now and typically installed by default.

4) You can extend simple scripts with GUIs and output processing
    (PDF, visualization) better (if there are libraries available).
    Shell scripts will meet their limit pretty soon.

5) If everyone would focus on Python we could collect some money
    and pay Schorsch to write a proper library for Radiance. That's
    only my biased opinion, of course ;)


On the whole I'd recommend one of Python/Ruby/Perl for more ambitious
scripting. For simple throw-away-scripts any shell will do and it's
basically a matter of your personal preference.



Enjoy the freedom of choice,

Thomas



More information about the Radiance-general mailing list