Vintage Palmtops Tips & Tricks

13Aug/110

Psion in the Shell

Writing about programming tools for the Psion I mentioned about running the scripts from the shell. It sounds natural for someone who lives in the world of a prompt and a flashing cursor, but (un)fortunately Psion's philosophy denies the existence of this world. For the heretics several tools appeared, of which I'll try to review a few.

epocemx in fact isn't a shell. It's rather an environment, consisting of tools which facilitate the development of EPOC applications under Unix. Thanks to this project Python and Perl have been ported to Psion. epocemx provides a runtime environment for the Psion, and that's what I'm going to write about.

Upon installation, emx creates a directory on the target drive. This is its "filesystem", similar to that of Linux/Unix. You may find there such directories as /usr, /bin or /dev - something that will make a Linux user feel at home. To maintain compatibility with Unix, symlinks are also allowed. Apart from its own directory, emx is able to operate on the entire Psion filesystem. There are some essential Unix commands built in or included in the base package (emxuser.sis), like ls, cat, mkdir or cp, and much more can be found in emxutil.zip, e.g. less, grep and sed. Shell scripts with control structures like if, case, for, until and while may be created.

emx can run Psion executables (.exe) as well as application files (.app). The only drawback is that "alien" programs (not designed for emx) run as a separate instance, independent from the shell (well, it isn't that much of a drawback, as you can kill a stucked application without touching emx), and return to the system, leaving emx console in the background. Keep in mind, that a leading dot (i.e. ./program_name) is required to run a program from the current directory (the ".exe" extension may be omitted). Of course you can pass arguments to the programs, so ./Lua Examples/hello.lua or ./Vim newfile.txt will work (but in the latter case you may be surprised where Vim will put your file - it seems that "alien" programs don't follow the shell's current directory).

Shell5 is another shell for EPOC. At the first glance, it looks like something between DOS and Linux. Unix-style commands (ls, cp etc.), but backslashes in paths. Unix-style variables, but batch files like in DOS. Shell5, like epocemx, allows input/output redirection and "pipes". Also keyboard macros are possible to define.

The major drawback is that the shell doesn't run .exe files. Some have plugins for Shell5 (e.g. Lua), but the majority of software provided only with an .exe file won't run with it. Applications (.app) as well as compiled OPL programs (.opo) can be executed.

EpocDos is a choice for those who miss the good old C:\> prompt. It resembles MS-DOS with its commands, layout and overall philosophy. Simple, but well-designed it is really comfortable to use. With no redirections, no sophisticated shell scripting (only DOS-like batch files) and a simple set of commands it's rather intended for performing simple file tasks and running programs - but that is what it's good at. EpocDos can run all Psion executables: .exe, .app and .opo. You don't even need to specify the extension. After exiting, programs return gently to the console.

There are some drawbacks, obviously. To pass parameters to the program, you need to execute it with the command run or call (depending on the file type) and specify the full executable name (with extension). Unlike in previous shells, there's no filename completion (instead Tab acts like a file selector, showing the following files after each keypress) and you can't edit command line (but you can access the history, pressing up key). What I don't understand is the inability to access directories typing \directory or d:\directory. You can't change the directory with cd c:\. Instead you must type cd \. Combinations like ..\.. are also not permitted. I don't know, whether it's a bug or a feature, but it's really annoying.

Name Style .exe .app .opo Scripting I/O flow Download
epocemx Unix-like + + - shell scripts + Sourceforge
Marcus von Cube's page (emxutil.zip)
Shell5 Unix/DOS-like - + + batch files + Bioeddie's
EpocDos MS-DOS-like + + + batch files - SoftLow.com
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.