Scripts

Usage

This is a collection of various scripts for personal use, that I non the less deem good enough for the generel public. (I make no guarantees however!) The following usage section gives a brief description of the various UNIX scripts, and their manuals. (the non-UNIX ports are nearly identical) See the Install section below for specific installation instructions.

Games

Don't get your hopes up! "Games" here should probably read: "increadibly booring educational tools and humorless jokes". It's just a collection of simple semi-recreational oddities, kudos to anyone who manages to have fun with them!

rdate, rrdate

These tools mimic the UNIX command date, but prints the date according to the Classic Ravtaalian Calendar of Progress (rdate), or the Revised Ravtaalian Calendar (rrdate).

rcal, rrcal

These tools mimic the UNIX command cal, but prints the monthly calendar according to the Ravtaalian Calendar of Progress. rcal for the classic, and rrcal for the revised version of this calendar.

rcalendar, rrcalendar

Like the above examples, these tools also mimic a classic UNIX tool, calendar, but uses the Ravtaalian Calendar of Progress.

rcron, rrcron

These are helper tools for sysadmins using Ravtaalian dates, they can take crontabs with such dates and convert them into regular dates, that your systems cron daemon can understand.

rat, rrat

These are just thin wrappers around the at command, they let you schedule commands using Ravtaalian dates.

Manuals

PIM

This is a collection of scripts for "personal information management", in other words, various tools for getting yourself organized. This is a tricky concept to be sure, and these tools are in no way pretensious. They are just simple scripts that mainly help you write/read text from convenient places.

Since the scripts work with plain text files, it is easy to manually edit the pim date with a text editor. They are crude simple and boring efficient by design, so feel free to read the source code and adjust or expand them to suit your own workflow. And as always, read the manpage before using the program! Some of these scripts are discussed in the PIM section of the Console Desktop Guide. (and the Plan 9 variations in the Plan 9 Desktop Guide)

pass

pass is a trivial password manager. You first write down all your passwords in a plain text file (read the manual to find out where you're supposed to put it). You can format this however you want. Then run pass -e to encrypt the text file. The passwords are now "safe" (see BUGS section in the manual) from prying eyes. You can then run pass keyword to search for keyword in the encrypted database.

que

que is a basic queue tracker. It takes a plain text file as argument, and iterates over it one line at a time (for each time you execute que on that file). So for example, if your watching a TV show or reading a book, you can write down a list of all the episodes/chapters, and use que to automatically watch the right episode or read the correct chapter. The script is stupefyingly simple, but I have found it to be amazingly useful!

2do

2do is a very basic 2do list manager. A 2do list is just a text file, with one task per line. The script will let you add tasks to the list (one at a time - if you need to add more just use a text editor), remove tasks from it, or just list the tasks. If you need something more complex, coupling 2do with grep/awk, and a few well chosen conventions can go a long way...

ckbox

ckbox is a checkbox filter, which can be used much in the same way as 2do. But there are some notable differences. First of all tasks are not just lines, but lines containing a checkbox, '( )' if unchecked, '(X)' if checked. The script will ignore other lines, witch enables you to mix checkbox tasks into a freeform document (the boxes may appear anywhere on a line). The boxes are also either checked or unchecked, the lines are not simply removed as in 2do. Finally this script does not look for files in a fixed directory, as 2do does, instead it is meant to be used as a filter.

calendar

calendar is a classic UNIX reminder service. You write your appointments to ~/calendar, one appointment per line, and run the program to list events happending today or tomorrow. This script is a simple reimplementation of the UNIX program, it does not include all the functionality of the original version, in particular its understanding of dates is more limited

Manuals

Install

The scripts are available for various systems, but unless you are a bit weird, you almost certainly want to look at the UNIX (eg. Linux/BSD/Mac/etc...) section directly below, and ignore the rest.

UNIX

These scripts are simple and should work out of the box on most UNIX systems. They have been tested on recent Linux, FreeBSD, OpenBSD, NetBSD, Dragonfly BSD, Illumos and Haiku systems. They usually don't have dependencies beyond standard system utilities, but some scripts also depend on other scripts in the same package.

To install the scripts run the following commands:

$ cd
$ tar zxf unix_scripts.tar.gz
$ chmod +x bin/*
            

The executable files are placed in ~/bin, the manuals in ~/man/man[1-10], and finally some dot files may be placed directly in your home directory. You can check the contents of a package before installing it if you want:

$ tar tzf unix_scripts.tar.gz
            

The above mentioned conventions assume that ~/bin is in your executable search PATH, and that ~/man is in your MANPATH. If this is the case (by default it will be on some UNIX systems), running the scripts and reading their manpages is straight forward:

$ myscript
$ man myscript
            

Even if this isn't the case, you can still execute the scripts and read their manpages manually:

$ ~/bin/script
$ groffer ~/man/man1/script.1
            

You can check your PATH/MANPATH settings simply by printing them out: echo $PATH ; echo $MANPATH. If ~/bin and ~/man isn't in your executable/manual search path, adding these lines to your ~/.bashrc should do the trick:

export PATH=$PATH:$HOME/bin
export MANPATH=$MANPATH:$HOME/man
            

The last line here is optional, and unneccessary on some UNIX systems. Debian, FreeBSD and Solaris for instance will include ~/man in your manual search path, if ~/bin is included in your PATH.

Weird UNIX Systems

Great care has been taken for these scripts to be as portable as possible across different UNIX systems, but it wouldn't be UNIX if there weren't weird edge cases...

reimplementations

Some of these scripts are simple reimplementations of common UNIX programs, in case your UNIX version doesn't have them. An example is the seq utility, needed by some scripts, but that OpenBSD lacks. Another example is the calendar pim tool, which I find very useful, but which Linux lacks. In theory these reimplementations can cause naming conflicts, but that shouldn't be an issue unless you add $HOME/bin before the standard search path.

Console and other shells

If you are working on a non-graphical UNIX system, your shell configuration should go in ~/.profile, not ~/.bashrc. If you are planning to work on both a graphical desktop, and the text based console (aka tty), you can put the configuration in ~/.profile, and source that file in ~/.bashrc:

. $HOME/.profile
            

Of course you may be using a different shell then bash. Type ps $$ to find out, and read that shells manpage to find out how to configure it. (ps: most shells read ~/.profile on a non-graphical settup, but not all)

Haiku

The PATH and MANPATH lines above should go in ~/config/settings/profile.

AIX, HP-UX, IRIX, Unixware, True64, Xenix, NextStep, MacOS...

My scripts should work just fine on these systems, but none of these commercial systems have been tested. (if you give me a million bucks I might be persuaded to do this...) If you are having problems check out the caviats above, and perhaps also check out the v7 port of these scripts, to see how to run such commands on ancient UNIX.

Windows/DOS

Even though Microsoft is decidedly not UNIX, it is possible to run UNIX software on their operating systems, through Cygwin for Windows and other solutions. This is untested however, and will remain so, if I have anything to say about it...

Android

What?

v7

UNIX Version 7 (aka "the last true UNIX"), originally created for the PDP-11 in 1979, is about the oldest functional version of UNIX that exists. It introduced many utilities and functionality that are now taken for granted, such as awk, tar, make, a portable C compiler and library routines such as stdio and malloc, the bourne shell, and with it, environment variables. Thanks to PDP-11 emulators, and even a port of v7 to x86, it is fairly easy to run the system today on a virtual machine. (for more information about getting and running this, and other ancient UNIX systems, see this article)

Installing the files onto a virtual v7 system is somewhat tricky. (see the above mentioned article for some tips) Worst case you can always copy paste the files from a host terminal to a terminal running v7 in a PDP-11 emulator. Assuming you have recreated the filepaths in the tarball in your home directory on v7, and copied over the files (you can of course copy the scripts directly into /usr/bin and the manuals into /usr/man/man[1-8] if you want), you can change the PATH line in ~/.profile to also search for programs in your home directory:

PATH=$HOME/bin:/bin:/usr/bin:/usr/ucb; export PATH
            

There is no MANPATH in v7, you need to copy your local manpages into the system manuals in order to read them with man:

$ for dir in man/*; do cp $dir/* /usr/$dir; done
            

Of course you can also just read the manpages manually:

$ nroff -man man/man1/script.1 | more
            

Plan 9

These are simple rc scripts that should work out of the box on most Plan 9 systems. They have been tested on 9front, 9legacy and Harvey. They usually don't have dependencies beyond standard system utilities, but some scripts also depend on other scripts in the same package.

To install the scripts run the following commands:

; cd
; tar zxf plan9_scripts.tar.gz
; chmod +x $home/bin/rc/*
            

The executable files are placed in $home/bin/rc, the manuals in $home/man/[1-8], and finally some support files may be placed in $home/lib. You can check the contents of a package before installing it if you want:

; tar tzf plan9_scripts.tar.gz
            

To read the manpages directly with man, either copy them to your system man pages: dircp $home/man /sys/man, or bind them to your system man pages by adding this line to your $home/lib/profile:

; for(dir in $home/man/*){ bind -b $dir /sys^`{echo $dir | sed 's,'$home',,'} }
            

Plan 9 Port

Plan 9 Port, or p9p, is a UNIX port of the Plan 9 userland utilities. The port does not fully replicate the Plan 9 environment, as shortcomings in UNIX either makes the Plan 9 functionality very messy to implement, or down right impossible. In practise using p9p often requires a bit of mix and match between Plan 9 and UNIX utilities.

This reality is reflected in the p9p scripts. Idealy you should be able to just drop original Plan 9 scripts into the p9p environment, and have them work with a minimum of tweaking. In practise however this seldom works. The scripts assume that Plan 9 Port is installed in /usr/local/plan9, if this is not the case, you need to change the shebang line in the scripts (ei. the first #! line).

To install the scripts run the following commands:

; cd
; tar zxf p9p_scripts.tar.gz
; chmod +x plan9/bin/*
            

By convention the scripts are installed in ~/plan9/bin, the manuals in ~/plan9/man/man[1-9], and some support files in ~/plan9/lib. It is possible to install the scripts directly into ~/bin, which is a more standard location for user scripts, but the purpose of this segregation is to avoid possible conflicts between UNIX and Plan 9 scripts and manuals that may have the same name. It also allows you to have both the UNIX and the Plan 9 Port scripts installed on a UNIX machine, both using different environments. So that you can import/export data files from a true Plan 9 system and work with them on UNIX, while using native UNIX tools to manage the UNIX environment.

You can check the contents of a package before installing it if you want:

; tar tzf p9p_scripts.tar.gz
            

As for configuring the correct executable and manual search paths, it's a little tricky. You basically want to create two distinct environments, one for UNIX and another for Plan 9 Port. You may or may not wish these environments to mesh.

To make the p9p scripts and manuals available from your UNIX environment (but to overwrite these with UNIX commands/manuals if there is a conflict), you can add these lines to your ~/.bashrc, or other appropriate shell configuration file (the last line may not be necessary):

export PATH=$PATH:$HOME/plan9/bin
export MANPATH=$MANPATH:$HOME/plan9/man
            

To make the UNIX commands available from your Plan 9 Port environment, you can add this line to your ~/lib/profile (this only works if you run 9 rc -l, simply running rc will not set up the correct path):

path=($home/plan9/bin $path)
            

The only way to access the manuals directly from your Plan 9 Port environment, would be to copy them to the Plan 9 Port system files: sudo cp -r $home/plan9/man $PLAN9. Of course you can read them manually without installing them:

$ groffer $HOME/plan9/man/man1/script.1
            

Inferno

Inferno is an operating system designed by the same folks who gave us Plan 9 (and UNIX for that matter), and it shares much of the same design principals, and even some code, with Plan 9. Nevertheless Inferno is a completely different operating system. The most novel aspect of Inferno is that it can run as a userland client on top of a host operating system, be that UNIX, Plan 9 or Windows. (it can also run natively as the host operating system) This is somewhat similar to the concept of Java, except that Inferno not only provides a programming language (it does provide a unique language similar to Go; Limbo), but a fully functional operating system as well.

The following collection of programs are simple shell scripts that usually don't have dependencies beyond standard system utilities, but some scripts also depend on other scripts in the same package. They should work out of the box.

To install the scripts (from a UNIX host) run the following commands:

$ cd $INFERNO/usr/$USER
$ tar zxf ~/Downloads/inferno_scripts.tar.gz
$ chmod +x dis/*
            

The details here may vary depending on your setup. For example Inferno may run hosted on UNIX, Plan9 or Windows, or run natively as the host os. As mentioned the above instructions assume that you are executing the commands from a UNIX host, the following commands however assume you are running from within the Inferno environment.

The executable files are placed in $home/dis, the manuals in $home/man/[1-9], and finally some data files may be placed in $home/lib. You can check the contents of a package before installing it if you want:

; tar tzf inferno_scripts.tar.gz
            

To run these scripts directly and view their manpages, you can bind them to the system files by adding these two lines to /lib/wmsetup (this will only take effect when you run the desktop wm/wm):

bind -a $home/dis /dis
for dir in $home/man/* { bind -a $dir `{echo $dir | sed 's,'$home',,'} }
            

Emacs

These are just Emacs wrappers for the UNIX scripts. To install them, append the files to ~/.emacs.

Download