-->

Previous | Table of Contents | Next

Page 264

...

Initial balance? 2500.00



current balance = 2500.00

transaction? 49.95

current balance = 2450.05

transaction? 32.18

current balance = 2417.87

transaction?

...

This is only one way to use the bc command's language. With a little effort, you can write your own. But if you'd rather use more complex programs to perform calculations, you know that you should use a spreadsheet application. The next section discusses the variety of spreadsheets for Linux.

Spreadsheets

Spreadsheet programs offer a convenient way to store and manipulate financial or scientific data. You can use these programs to help manage your home or a business. Typical uses involve personal finance, such as tracking loans and investments, or running business inventory control, personnel worksheets, or accounting tasks.

You can also use these programs to do forecasting, or "what if" calculations. This can help you create estimates you can use for home mortgages, auto loans, and even home construction. You're limited only in your imagination with most of these programs, and many not only offer the ability to work as a whiz-bang calculator, but will also create graphic charts so you can graph your data visually.

Although you won't find any of these programs on your CD-ROM, once you've connected to your ISP (see Hour 10, "Connecting to the Internet"), you can use the lynx Web browser or your downloaded copy of Netscape to get copies or more information about them. If you need to have a spreadsheet program to use with Linux, you're in luck, because at least a dozen are available, and nearly half come with source code so you can make changes, add features, or fix problems.

Using the Public Domain sc Spreadsheet

The sc (spreadsheet calculator) command (see Figure 17.3) is a freely available, public domain spreadsheet program. This program is a collective work of nearly 60 programmers, and runs on many different UNIX systems. With a little effort in learning its commands, you'll be able to build very capable spreadsheets. The sc program is free, and it comes with source code. A short tutorial and manual page documenting its features is included.

This program is especially handy if you're running Linux on a small hard drive and disk space is at a premium. The sc program requires only about 120 kilobytes of disk space, but provides a lot of features.

Page 265

Using the sc program is easy. You can load programs from the command line when you start it, or you can load and save programs while it's running. You can run this program as follows:


# sc

If you'd like a quick reference to the sc commands, use the sc companion command (included with the source code), the scqref command, and pipe the output through the nroff

Figure 17.3.
The sc spreadsheet
calculator works with
or without the X
Window System, and
it comes with a short
tutorial.

and less commands. Then either read at your leisure, or redirect to a file you can edit and print, for example:


# scqref | nroff -man | less > scref.txt

To learn how to use the sc spreadsheet program, load the sc program's tutorial, which you'll find under the /usr/lib/sc directory:


# sc /usr/lib/sc/tutorial.sc

This will run sc and load the tutorial. An included program, called psc, can help you import text-only data files by converting word processor or other spreadsheet program files. The sc program has more than 60 built-in functions, and because you get the source code, you can add your own. One place to find the source code to the sc spreadsheet is




http://www.cdrom.com/pub/linux/slackware_source/ap/sc

Plotting Graphics with the X11 xspread Spreadsheet

Page 266

If you like the sc spreadsheet program, but would like updated menus and features, you may want to try the xspread program, by software engineering teams at the University of Wisconsin-Milwaukee. This program requires that you're running X11, but offers these additional features:

The xspread program works the same way as the sc spreadsheet program. You can use this program with any sc spreadsheets you've devised. Along with the sc tutorial, you'll find an expanded manual detailing the xspread improvements.

You can also generate graphics with the xspread program. By selecting Graph, then defining a label range of cells, and a data range of cells, you can quickly generate visual representations of your data. To print your charts, capture the chart window with the xv command (see Hour 16, "Graphics Tools").

Unlike sc, this program appears to be distributed under the GNU General Public License, even though its manual page states that xspread is in the public domain. This means that the software is free, and you can make any changes you want, but you cannot claim the program as your own. One source of the xspread spreadsheet package is at this location:




http://www.cdrom.com/pub/linux/slackware_source/xap/xspread

Finding and Using the teapot Spreadsheet

As an alternative to the sc program, you might want to try the teapot (table editor and planner) spreadsheet program by Michael Haardt. This spreadsheet works under X11 or your console. The program's menu appears at the bottom of your screen, where you'll find nearly all of the features of sc and xspread. The teapot program also has these features:

Although the teapot program does not have the graphics features of the xspread version of the sc spreadsheet, you'll find that the teapot spreadsheet has much better documentation, including example programs, and an extensive tutorial that takes you from the concept of

Previous | Table of Contents | Next