DINO: Visualizing Structural Biology
Table of Contents
User Manual

3 Shell

The DINO shell provides an interface between program and user, just as the UNIX shell provides an interface between operating system and user. The DINO shell offers a prompt in the terminal, where commands can be typed in. In essence, the input is parsed, some syntax rules are applied and the command line is broken down into words. The first word is checked against the internal shell commands, if no match is found the command line is passed to the database manager.

3.1 Syntax


Words beginning with a $ are interpreted as variables and are replaced with the value of the variable. (see commands set and unset below).

Recursive Subprompts

An expression enclosed in square brackets is considered a subprompt. It is evaluated first, and the result (return value) of the sub-expression is inserted at the position of the subprompt. Consider the following input:

> expression1 [expression2 arg]

expression2 arg is treated as a separate command, its result result2 is inserted in the place of the original subprompt and becomes:

> expression1 result2

The subprompts can be nested (almost) unlimited.


A script is called with the @ sign, followed by the filename. Additional words are interpreted as parameters and are passed as variables to the script, accessible as $1 , $2 ... $n (n = number of arguments).

Syntax: @scriptfile [param1 ...]


Two slashes denote a comment (C++ style) and can appear anywhere in the line, with the rest of the line (up to newline) treated as a comment.

Example: // this is a comment

Character Protection

Use the backslash to protect the following character from being interpreted by the shell parser. This is useful when continuing a line in a script or literally inserting a $ or square bracket.

Example: // a line can be continued if the \
         last character before newline is '\'

Splitting Input

Multiple command lines can be entered on a single line when separated with a semicolon:

Syntax: command1 arg1 ; command2 arg2 ; command3 arg3


3.2 Shell Commands

Writing Output to the Terminal or a File

The command echo prints all of its arguments to the terminal. The output can be redirected into a file with > (write) or >> (append):

Syntax: echo WORD1 [WORD2 ...] [>[>] file.out]

Variables and Aliases

Variables are defined and removed with set and unset . The command var will list all currently defined variables with their values.

Syntax: set VAR VALUE
        unset VAR [VAR ...]

An alias is a special form of variable. It is defined with alias and removed with unalias .

        unalias ALIAS

If the first word on the command line (or the first word in a subprompt!) matches ALIAS , it will be replaced by EXPRESSION (which can consist of multiple words). alias by itself will list all defined aliases.

Pausing Script Execution

In a script, the command pause will stop execution until a key is pressed. If the key is ESC, script execution is stopped.

Stopping Script Execution

In a script, the command break will discontinue script execution and return one level up, either to the calling script or the command prompt.

Executing a Unix Command

Use system or ! to execute a command in a unix shell

Example: system gimp pic1.png
         !ls -l


To quit DINO use exit . To exit DINO use quit 1.

3.3 RPN Stack

The commands push , pop , peek , opr , clear , dup and show manipulate the arithmetic RPN stack2. push moves all arguments onto the stack (from left to right). pop retrieves values from the stack, optionally into supplied variable names. peek returns the topmost value without removing it from the stack. opr takes a list of operator which are applied (left to right) to the stack. clear empties the stack. dup duplicates the top value. show displays the complete stack.

Syntax: push VAL [VAL ...]
        pop [VAR1 [VAR2 ...]]
        opr OPR

The availabe unary and binary operators are shown in Table 1 (P. 11).

Unary and Binary Operators of Shell RPN Stack

unary operator



changes the sign on scalars, elements of vector or matrix

inc dec

increases, resp. decreases scalar, elements of vector or matrix by one


return absolute of scalar or length of vector, invalid for matrices


inverse of scalar, invalid for vectors and matrices

log ln exp sqrt

calculates the decimal resp natural logarithm, exponential function or square root of scalar, invalid for vector or matrix

sin cos tan asin acos atan

trigonometric functions for scalars, invalid for vector or matrix

int float

returns the integer part or float, or forces return of float


returns determinant of matrix, invalid for scalar and vector

binary operator


+ -

basic addition and subtraction, vectors and matrices must have identical elements


multiplication, valid combinations: scalar*scalar, scalar*vector, scalar*matrix, vector*vector (dot product), vector*matrix, matrix*matrix


simple division, valid combinations: scalar/scalar, vector/scalar, matrix/scalar


power of x (1st position) to y (2nd position)


calculates cross product between two vectors


Requires a direction vector V and a scalar value S, returns the rotation matrix of a S degree rotation around axis V

3.4 Pre-defined variables and aliases


stereo: scene stereo
mono: scene mono
write: scene write


dna: (rname=A,C,G,T)
rna: (rname=A,C,G,U)
aliphatic: (rname=ALA,GLY,ILE,LEU,MET,PRO,VAL)
aromatic: (rname=PHE,TYR,TRP)
hydrophobic: (rname=ALA,VAL,PHE,PRO,MET,ILE,LEU,TRP)
basic: (rname=ARG,LYS)
basic2: ((rname=LYS & aname=NZ) | (rname=ARG & aname=NH1,NH2))
acidic: (rname=ASP,GLU)
acidic2: ((rname=GLU & aname=OE1,OE2) | (rname=ASP & aname=OD1,OD2))
polar: (rname=SER,THR,TYR,HIS,CYS,ASN,GLN)
polar2: (	(rname=SER & aname=OG) | (rname=THR & aname=OG1) |
	(rname=TYR & aname=OH) | (rname=HIS & aname=ND1,NE2) |
	(rname=CYS & aname=SG) | (rname=ASN & aname=OD1,ND1) | 
	(rname=GLN & aname=OE1,NE1) | (rname=TRP & aname=NE1)) 



1. or stop bye adios ciao finish terminate

2. In a nutshell: In RPN (Reverse Polish Notation), a stack is filled with values, and an operator is called that uses the topmost value (unary op, e.g. sqrt) or the two topmost values (binary op, e.g. +), placing the value back on the stack. A simple arithmetic expression as 1+1 becomes 1 1 +, a more complex as (1+2)*(4/5+6) becomes 1 2 + 4 5 / 6 + *. People used to the HP calculators or programming PS will be familiar with this approach.