home *** CD-ROM | disk | FTP | other *** search
-
-
-
- PSH(1) PSH(1)
-
-
- NNAAMMEE
- psh - the Penguin shell ;-)
-
- SSYYNNOOPPSSIISS
- ppsshh [-c command | file]
-
- DDEESSCCRRIIPPTTIIOONN
- This manual page documents psh, a very simple bash-like
- shell written to run under RISC OS.
-
- The main purpose of psh was to add GNU readline editing
- facilities to the RISC OS CLI and to provide a shell
- which could be executed usefully from vim. (Originally
- :sh from inside vim would call GOS. But GOS exits after
- an application is run, so things like e.g. ls would cause
- it to exit).
-
- BBUUIILLTTIINNSS
-
- psh supplies a number of builtin commands and facilities
- to make things look more like Unix. These will now be
- described:
-
- . Execute commands from a file.
- This is the analogue of "source" under
- csh if that's your preferred shell.
-
- autoconv Add a command name for uname conversion.
- psh was compiled under UnixLib. This
- means that it prefers to use Unix style
- filenames (e.g. $.bin = /bin). Such names
- are not translated by the shell by
- default. This is because many other
- UnixLib programs exist out there and
- these also prefer Unix filenames.
-
- However there are a lot of programs which
- *don't* understand Unix filenames.
- autoconv supplies a method to allow
- automatic conversion for these programs.
- It specifies a command name which should
- have automatic Unix name argument
- conversion whenever it is run.
-
- For example:
- autoconv rename
-
- From now on, an operation of the form
- rename /bin/ls /bin/ls-old
-
- will automatically get translated to
- rename $.bin.ls $.bin.ls-old
-
- (Read the UnixLib manual for full details
- of filename translation).
-
- autoconv uses exact text matching, so
- "Rename" will be unaffected, as would
- *rename. This allows the autoconv
- operation to be avoided when necessary.
-
- bye Same as exit.
-
- cd Change directory, using CDPATH.
-
- CDPATH is an environment variable
- containing a list of directories which
- can be searched by the cd command. If a
- command of the form "cd fred" is issued,
- cd first looks in the current directory
- for one called fred. If this is not found
- then the directories listed in CDPATH are
- searched. A match in any of these
- directories will cause a directory change
- to the appropriate place.
-
- dirs Show the directory stack.
- (see pushd).
-
- exec Replace this shell with a command.
- The specified command is run and the
- current copy of the shell exits.
- e.g. exec "ls -l"
-
- exit Same as bye.
-
- help Show help on a command.
- This gives a one-line help message for
- each builtin command. Note that this
- overloads the RISC OS help command - to
- get to this, use *help.
-
- history Show the history list.
- Each command executed gets placed in the
- shell's history list. The history command
- can be used to examine the list. The list
- can be navigated using csh style !
- expansions or using the arrow keys (see
- the manuals for GNU readline and history
- libraries for full details).
-
- popd Pop a directory from the stack.
- (see pushd).
-
- pushd Push a directory onto the stack
- pushd, popd and dirs are used to maintain
- a stack of directories. The action of
- pushd is similar to cd in that it changes
- directory. However, before doing so it
- records the current directory in a stack.
- A subsequent popd command can then be
- used to change back to the most recently
- pushed directory. The dirs command will
- list which directories are currently on
- the stack.
-
- psh has an additional facility over that
- of Unix shells. It uses the RISC OS
- "previously selected directory", "\". If
- the directory stack is empty and popd is
- issued then the PSD is selected. I find
- this useful for swapping between two
- directories without having to remember to
- do pushd.
-
- e.g.
- penguin: /home $ cd /bin
- penguin: /bin $ dirs
- \
- penguin: /bin $ popd
- penguin: /home $
-
- pwd Show the current directory.
-
- read Read a line into a variable.
- This stores a line read from the keyboard
- into a RISC OS system variable.
-
- source Execute commands from a file
- (See ".")
-
- As mentioned above, psh supplies a command line history
- and GNU readline editing. Both the history and readline
- functions are best introduced by the relevant GNU manuals
- (available from all good ftp sites!). The default psh
- configuration is exactly the same as the default readline
- except for the following changes:
-
- 1) Customisation filename: Under Unix readline this is
- .inputrc RISC OS filename limitations require this to
- be /inputrc instead.
-
- 2) The standard readline functions have been augmented
- with an extra one for Unix to RISC OS name conversion.
- This function, mapped to Meta-k by default, takes the
- Unix filename under the cursor and maps it to a RISC
- OS name. This is useful when a command is not in the
- autoconv list and completion has been used to generate
- its arguments.
-
- The function name is "riscos-name" and its mapping can
- be changed in the /inputrc file if necessary.
-
- 3) Meta-K is mapped to "cursor-edit-on". This enables the
- standard RISC OS cursor editing operations for the
- duration of the current line. A corresponding
- "cursor-edit-off" command is mapped by Meta-Meta.
-
- FFIILLEESS
-
- psh uses several files for startup (note that filenames
- listed in this section are RISC OS filenames).
-
- &./inputrc
- As mentioned above, this is actually a readline startup
- file. Its contents are documented in the readline manual.
- (This facility has not been tested!)
-
- &./history
- This contains a saved command history file from a
- previous shell session. It is read when the shell starts
- and written when it finishes.
-
- &./shrc
- This contains a list of commands which are to be run when
- the shell starts. This is useful to store a list of
- autoconv commands and set the prompt and CDPATH values,
- for instance.
-
- $.etc.shrc
- (Actually whatever /etc/shrc maps to under UnixLib)
- This is a global shrc which is sources by every user when
- the shell starts.
-
- BBUUGGSS
-
- There are no bugs. This program is perfect.
-
- Hmmm, believe that and you'll believe anything. Here are
- the ones that I've found so far:
-
- Command completion on files like fred/tar fails (press
- tab twice to get a list of matches and it will display
- "tar" rather than "fred/tar". The reason for this is
- simple - readline does not expect to find / in filenames.
- I suspect this would take a lot of hacking of readline to
- fix.
-
- Command completion *is* case sensitive, even though the
- filesystem isn't! So m<tab> will not match Makefile.
-
- Autoconv sometimes allows two copies of the same command
- to enter the list. I don't know why this is but it
- doesn't seem to cause any problems! Also it would be nice
- to have a "noautoconv" command. It would also be nice to
- have some way of specifying which arguments should be
- subject to conversion so that e.g. regular expressions
- don't get splatted!
-
- No scripting language is supplied. No way!
-
- All but the builtin commands are merely chucked at
- system() and RISC OS takes over from there. This may
- cause problems with some things. Redirection does not
- work for builtins.
-
- Please report any more to Alun Jones, auj@aber.ac.uk and
- I will try to fix them - no promises though!
-
-