Please see this


Contents

- INDEX
- Unix scripts Index
- HP-UX
- Solaris
- Linux Index
- General Unix
- Unix Networking
- Other Unix types
- Unix databases

Associated Information

- none

let and typeset

let is an alternative to expr for doing mathematical calculations. It is part of the posix shell and is similiar to the C programming statement

e.g. let $TOTAL=$TOTAL+1 will add one to $TOTAL

This can be alternatively expressed as (( $TOTAL = $TOTAL + 1 ))

To speed up the arithmetic calculation you can specify that $TOTAL is a number. This is done as follows:

typset -i TOTAL=10

Another use of typeset is to emulate the substring function found in other languages. e.g.

typeset -L4 var1="12345678" will set var1 to 1234

typeset -R4 var2="12345678" will set var2 to 5678

The string 12345678 can be replaced by a variable.


Copyright 2000 Intronet Computers Ltd
Email: Intronet Computers for enquiries