From faq 

Check if standard input is a terminal 

sh: if [ -t 0 ]; then ... fi
C: if(isatty(0)) { ... }

How do I "include" one shell script from within another shell script? 

All of the shells from the Bourne shell category (including rc) use the "." command. All of the shells from the C shell category use "source".

What "dot" files do the various shells use? 

Although this may not be a complete listing, this provides the majority of information.

csh
    Some versions have system-wide .cshrc and .login files.  Every
    version puts them in different places.
Start-up (in this order):
    .cshrc   - always; unless the -f option is used.
    .login   - login shells.
Upon termination:
    .logout  - login shells.
Others:
    .history - saves the history (based on $savehist).

If the shell is a login shell, this is the sequence of invocations: First, commands in /etc/.login are executed. Next, commands from the .cshrc file your home directory are executed. Then the shell executes commands from the .login file in your home directory.

tcsh
    Start-up (in this order):
        /etc/csh.cshrc - always.
        /etc/csh.login - login shells.
        .tcshrc        - always.
        .cshrc         - if no .tcshrc was present.
        .login         - login shells
Upon termination:
    .logout        - login shells.
Others:
    .history       - saves the history (based on $savehist).
    .cshdirs       - saves the directory stack.
sh
    Start-up (in this order):
        /etc/profile - login shells.
        .profile     - login shells.
Upon termination:
    any command (or script) specified using the command:
       trap "command" 0
ksh
    Start-up (in this order):
        /etc/profile - login shells.
        .profile     - login shells; unless the -p option is used.
        $ENV         - always, if it is set; unless the -p option is used.
                    /etc/suid_profile - when the -p option is used.
Upon termination:
    any command (or script) specified using the command:
       trap "command" 0
bash
    Start-up (in this order):
        /etc/profile  - login shells.
        .bash_profile - login shells.
        .profile      - login if no .bash_profile is present.
        .bashrc       - interactive non-login shells.
        $ENV          - always, if it is set.
Upon termination:
    .bash_logout  - login shells.
Others:
    .inputrc      - Readline initialization.

documented on: 02-21-99 11:46:23