[ previous ] [ Copyright Notice ] [ Contents ]

The Smeg Manual - Chapter 3
Making Smeg more usable.

It may seem from the above chapters that using Smeg requires lots of typing. While this is somewhat true, it can also be somewhat mitigated by using definable procedures and the .smeg1rc file.

3.1 Definable Procedures.

Before discussing procedures, it's somewhat important to point out one of the properties of the way Smeg parses files. It is smart enough to find mutiple commands on the same line, and parse them appropriately. Definable procedures use this property.

Defining a procedure associates a command string with a name. It's done using the def name string command. The string of commands is usually quoted using double quotes. A procedure can be called using the command call name. Calling a procedure parses the associated command string as if it was typed at the command line. For example:

     smeg> def beach "set lat 40.9266 set lon -73.3123"
     smeg> call beach

3.2 The .smeg1rc file.

On startup, Smeg looks for a file named .smeg1rc in the directory specified by the HOME environment variable. It runs any commands found in this file as if the commands had been typed at the prompt. You can also include comments in this file by beginning a line with the '#' character. The maximum length of lines in the .smeg1rc file is 512 characters.

The .smeg1rc file is useful for setting site specific defaults, as well as for defining procedures that can be referenced later.

[ previous ] [ Copyright Notice ] [ Contents ]
The Smeg Manual
Interim Release 1
Tom Rothamel tom-smeg@onegeek.org