programming / C++ / sailing / nerd stuff
© 2005 / Mario Konrad


Most users have to keep miscellaneous information about many things. The information may be the username and password to your favorite news site, the subscription information to the newspaper paysite, etc.

You may keep this information somewhere in a file but often it would be nice if this information could be used by a shell or a Perl script. This is where this tool comes in handy.

It is able to keep all your information within a file, only readable by the user himself (mode 0600), and access it using this tool. This is not an implementation of a mechanism like the Windows(tm) registry. The tool also lets you query your set of properties. You may have several property files.

Please note: this has nothing to do with Java(tm) property files.


This chapter describes the prop tool, its usage, the options, the expected strucutre of the property files and an example.

The Program prop

This tool is used to access the property files. It parses the files and returns the desired output, specified through the commandline parameters.

prop [-h | --help]
     [-f | --file] propertyfile
     [-l | --list]
     [-s | --set] set
     [-b | --brief]
     [-k | --key] key


Option Description
-h, --help show the help screen
-f, --file use the specified property file, instead of the default file: ~/.properties
-l, --list lists all sets, excludes -s
-s, --set shows the content of the specified set, excludes -l
-b, --brief brief output, shows only the keys of the properties
-k, --key shows only the value of the specified key, requires -s to specifiy the set

Structure of the property file

The structure of the property files is based on sets of properties. The file has to be maintained by a text editor (Emacs, vi, etc.). There may be a GUI, sometime.

The default file lies in the home directory of the user, name: .properties. You may choose your file using the parameter -f filename

The general structure of the file is hierarchical:

+-- set
|   |
|   +- property
|   +- property
+-- set
    +- property
    +- property


sets ::= (sets set) | set.

set ::= (SET identifier) | (SET identifier set_block) | SET identifier comma set_aliases) | (SET identifier comma set_aliases set_block).

set_aliases ::= (set_aliases comma identifier) | (identifier comma identifier) | identifier.

set_block ::= (open_bracket close_bracket) | (open_bracket properties close_bracket).

properties ::= (properties property) | property.

property ::= (identifer assign identifier) | identifier.

open_bracket ::= '{'.

close_bracket ::= '}'.

assign ::= '='.

comma ::= ','.

quote ::= '"'.

space ::= ' '.

identifier ::= ((alpha | digit) { alpha | digit | special1 }) | (quote {alpha | digit | space | special} quote).

alpha ::= a | b | .. | z | A | B | .. | Z | _ .

digit ::= 0 | 1 | .. | 9.

special1 ::= '-' | '+' | '.' | ':' | '/' | '?' | '&' | '@'.

special ::= '-' | '+' | '.' | ':' | ',' | ';' | '/' | '\' | '?' | '&' | '@'.

#*$ ::= COMMENT.


First, lets have a look at the file ~/.properties:

    set "Slashdot", slash
       username=thename  # this is a comment

    # this is a comment

    set "Kernel"

And now, we like to get the url from the properties:

$ prop -s Slashdot -k url

The result is:

Note: all strings are case sensitive. If you try $ prop -s slashdot in the example above you will not get any results.

In the example above, the set "Slashdot" has an alias, named "slash". It does not matter if you use the real name or the alias.

Note: the name of a set or a property within a set as well as the aliases must be unique!


All source code provided by this page is distributed under the terms of the GPL.

Use it on your own risk.

There is only a source distribution available, yet.


have to apologise, there is no installation routine, yet. Just compile it and copy the binary to a location of your choice. Be aware of the location, it has to be in your search path. I suggest /usr/local/bin or maybe ~/bin.


I have tested it under Cygwin as well, and it works.

Unpack the archive:

$ tar -xzf properties-x.x.x-src.tgz
$ cd properties-x.x.x

To compile just call:

$ make

Then copy the binary to some location:

$ cp prop /usr/local/bin

I regret to have no written man page yet. The only help is this documentation and:

$ prop --help

Change Log