# Brain Imaging & Analysis Center

### Site Tools

jvs:fscan:manual:chapter2:if

fScan Reference Manual, Chapter 2 (CmdLineOptions): if

## If -- Test some condition before executing commands

usage: -if EXPR { COMMANDS }
or: -if ! EXPR { COMMANDS }

• EXPR -This argument to IF must be an expression that will yield a numerical value.

If EXPR > 0, the COMMANDS string inside the curly brackets will be executed next.
Otherwise, the COMMANDS string will be ignored.

EXPR can be a single number, an arithmetic expression, or a status query. The EXPR argument must not contain any spaces within it. Examples of valid EXPR arguments are:

```\$xdim                - data set image width
?taskname            - query whether the TASKNAME variable is set for the current data set
\$zdim-30             - true if there more than 30 slices (ZDIM)
exists(param.tmp)    - true if file "param.tmp" exists ```

If '!' appears before the EXPR argument, the IF condition is true if EXPR is 0.
Note: the '!' must be separated from IF and EXPR by spaces.