The V6scripts project contains a collection of shell scripts, aka command files, provides some working examples of osh and sh6 scripting.
The INSTALL script in the collection automatically converts all of the sh6 command files to run with osh if sh6, glob6, if, goto, and fd2 are not installed on a given system.
Osh command files
The following command files run with osh(1):
* alarm.osh - Sleepy? Use the shell and terminal as an alarm clock.
* basename.osh - Print the filename portion of a pathname.
* bell.osh - Ring terminal bell according to defaults (or arguments).
* circalc.osh - Calculate 3 values representing the size of a circle.
* dirname.osh - Print the directory portion of a pathname.
* intcmp.osh - Compare 2 integers according to the given operator.
* lf.osh - Alias `lf ...' to `ls -F [options] [file ...]'.
* li.osh - Alias `li ...' to `ls -i [options] [file ...]'.
* ll.osh - Alias `ll ...' to `ls -AlF [options] [file ...]'.
* mksums.osh - Print a list of checksums for the given file(s).
* ncat.osh - Concatenate/print files w/ line numbers.
* oshdir.osh - Make or check/remake OSHDIR ($d) in the environment.
* oshlatest.osh - Check if the running shell is the latest release.
* pargs.osh - Print an argument list as interpreted by the shell.
* printenv.osh - Print the environment.
* strlen.osh - Print the length of a string argument.
* xtitle.osh - Set window title for terminal emulators under X.
Sh6 command files
The following command files run with sh6(1):
* counts.sh6 - Demonstrate using `shift' to control loop iteration.
* finfo.sh6 - Print information about a file or directory.
* killer.sh6 - Kill a command file if invoked w/ an unexpected name.
* nametest.sh6 - Exit true/false if pathname matches basename or not.
* now.sh6 - Print the date and time in a nice format.
* perror.sh6 - Print an error message for a command file.
* pusage.sh6 - Print a usage message for a command file.
* switch.sh6 - Simulate a C-like switch with if(1) and goto(1).
* which.sh6 - Print the location of program file(s) in PATH.
* zdate.sh6 - Print the date and time for a list of time zones.
What's New in This Release: [ read full changelog ]
· This version depends on osh-20130331 or later.
· It adds two new osh scripts, getheader.osh and myip.osh.
· It replaces $n with $# and $s with $?.
· It changes "sigign" invocations to "trap".