C-shell type interface for MSDOS
scsh is a unix CSH style command line interface for MSDOS. Provides reasonably close csh command line functionality with these omissions and differences:
Where options are :
Install scsh.exe along your path. On startup scsh will look for first a .cshrc file, and if that's not there a _cshrc file, in your home directory. Your home directory is defined by the variable HOME, and if it doesn't exist then the root directory is taken to be home.
If the first character of the executable name is '-' then a .login (or _login) file is also executed from our home directory. Note this is just to match the workings of the real csh under UNIX, and is probably pointless for DOS; and indeed the -L switch is provided to emulate this far more easily under DOS.
Also note that to get the best out of scsh you will need external programs to do your dirs, copies, etc - just like a normal UNIX shell. There are good versions of UNIX like utilities (including all the text processing ones) available from SIMTEL mirrors in the DJGPP directories. I'd recommend using these with scsh.
The parser at the moment is not at all clever, so as a quick workaround use
single quotes (') to escape history and $ characters. Eg.
in the real csh
becomes in scsh
Note that has an happy side effect of this method of escaping using shell variables in the prompt means they will only be expanded at execution time, so that
will work in the scsh.
Note that the normal escape character (\) still works at the start of a command to disable aliasing.
Unless stdin mode (-s or -i) is selected scsh reads commands through a PC specific input routine that allows editing and recognises these keys:
These commands are additional to the standard commands listed in the next section.
Prompts for a key, then once pressed returns the code for that key to be used by the .key command.
Without any arguments lists all the installed key expansions. Given a keycode it displays the expansion for that code. Given a code and string defines that key to return that string. The \n and \r C style escape characters will cause RETURN to be pressed for the string.
Note that keycodes are only expanded if the PC specific entry routine is being used and that recursive definitions are possible and will break Small CSH!
Without any argument removes all keycodes. Otherwise just removes the key definition for keycode.
Display build and version information. If the -l switch is used then
the limits defined at compilation of the shell are also listed.
Use the output from version -l when reporting bugs.
These csh commands are implemented in the following ways:
Assigns def to be the alias name. If def is missing the alias for name is displayed if defined. If just alias is typed then all the aliases are displayed.
This command is parsed and then ignored in scsh currently.
This command is parsed and then ignored in scsh currently.
Change the working director to dir. If no argument is given then
change directory to the users home directory ($home).
If the argument is a dash (-) and no such directory exists then the previous
directory is used as the argument (see $oldcwd).
These commands are parsed and then ignored in scsh.
Prints the current directory stack, most recent first; the first being the current directory.
The arguments are printed to stdout, separated by spaces.
Output is terminated by newline, unless -n is supplied.
Note that the following C style escapes are allowed:
\n Newline \m Carriage return \a Alert (bell) \t Tab \0n 1,2,3 or 4 character octal code.
Executes the argument, and then takes the output from the command and uses that as a command.
Execute command in place of the current shell.
Exits to the process which invoked scsh, returning a status code of n if passed, zero otherwise.
This command is parsed and then ignored in scsh currently.
Performs wildcard expansion on argument. Resulting names are printed to stdout, separated by the nul character.
This command is parsed and then ignored in scsh currently.
This command is parsed and then ignored in scsh currently.
Display the history list. If n is given, displays only the n most recent entries.
-r Reverse printout order -h Don't prefix output with history numbers
This command is parsed and then ignored in scsh currently.
Displays the limits of resource usage available to the shell. The hard limits
are displayed if -h is supplied.
Note that unlike the real csh limits can only be displayed, not set.
In scsh the equivilent of 'exit 0'
Takes the top entry on the directory stack and cds there. If +n is supplied the nth item is removed (where 0 is the most recent).
Pushes the current directory onto the directory stack and cds to
dir. If no arguments are given the top two directories on the
top of the stack are swapped. If +n is given then the stack is
rotated so the nth element is on top and that dir cd'ed to.
If the argument is a dash (-) and no such directory exists then the previous
directory is used as the argument (see $oldcwd).
This commands is parsed and then ignored in scsh currently.
Repeat command count times.
With no arguments set displays all the current shell variables.
If just var is supplied var is set to an empty value. When value
is supplied var is set to value [either a single word or
a (word list)].
The second form replaces element n of var with word.
With no arguments displays all current environment vars. With VAR sets the environment variable up to be empty. If value is supplied then VAR is set to value.
The first word of the set var is discarded and the remaining elements moved down (ie. $var[2] becomes $var[1]). Shifting and empty or non-existent set is an error.
Reads commands from file. If -h is supplied the commands are added to history, but not executed.
This produces differently output to the normal time command. On it's own, it
reports the length of time since startup, and given a command it will reply
with a time taken to execute the command. The resulting output is in the
form:
[n days] hh:mm:ss.mmm
This command is parsed and then ignored in scsh currently.
Discard aliases that match (filename substitution) pattern. All aliases are removed by unalias *.
This command is parsed and then ignored in scsh currently.
Remove variables whose names match pattern. All variables are removed by 'unset *' - this is not advisable!
Remove variable from the environment. Unlike unset no pattern
matching is done.
NOTE: This is currently unimplemented.
This command is parsed and then ignored in scsh currently.
This command is parsed and then ignored in scsh currently.
Aside from various commands, which are parsed and not yet implemented, these commands are parsed, but print a warning saying they are not supported :
Some shell variables have special meaning to the shell itself. These are :
The process ID of the shell. This will return a meaningless, semi-random value under DOS.
Your current directory.
Your previous directory. Initially the same as cwd on start up.
If set then commands are echoed just before being executed and after all expansions have been done to the line.
if set and the PC specific input routines (ie. scsh was not
started with -i or -s) used allows filename completion. Pressing
ESCAPE at the end of a word will try and complete the argument to
a filename. Pressing ^D will show matches for the current word,
e.g if directory holds fred, freda and frog then :
> vi fre[CTRL D]
fred freda
> vi fro[ESCAPE]
> vi frog
Note the way the expansion works with .exe files too - e.g if directory holds
prog.exe and prog.c then :
> pr[ESCAPE]
> prog
> prog.e[ESCAPE]
> prog.exe
If set, the filenames ending in any of the set's listed extensions are omitted from filename completions. Defaults to (.o).
If set then all '/' characters in the command line are converted to '\' characters, unless enclosed in single (') quotes. Defaults to being unset.
Setting this to a number defines who many of your previous commands are stored in the shell's history.
Setting this to a number defines how much of your history is saved into a file called $HOME/.history (or _history if that cannot be written). On next starting the shell this file is read and the history populated with it.
The users home directory. Initialised but not used by scsh, so unsetting or setting to different values has no effect.
If set and using the PC specific input routines (ie. scsh was not started with -i or -s) then ^Z (EOF) is ignored on the input steam. Defaults to set. Note that ignoreeof does not currently work if stdin is being used for input.
If set redirecting out to a file that already exists; or doesn't exist if the redirection is an append; is an error.
Switch off wildcard expansion. eg.
> echo *
fred freda frog
> set noglob
> echo *
*
If set then wildcards that don't match anything are passed onto the
program being called. eg.
> ls *
fred freda frog
> ls *.XXX
scsh: no match
> set nonomatch
> ls *
fred freda frog
> ls *.XXX
ls: *.XXX not found
Lists the directories to search to find executables. Note that the environment variable PATH is updated whenever this variable is set and likewise the set is updated anytime setenv PATH=<path> is done.
If set and the PC specific input routines then the keyboard is switched to insert mode. Unset to go back to overwrite. Note that using the 'Insert' key on the keyboard also alters the mode and this variable.
If set the value of prompt is displayed in front of the next line of user input. Note that in scsh variable expansion is done on the value, so this will work : set prompt='$cwd) '
The status code returned by the last command.
Your user name. Initialised but not used by scsh, so unsetting or setting to different values has no effect.
If set then the command line is echoed after history substitution has taken place.
Contains version number of scsh.
Mail problems (include the output from the .version -l command) or fixes to ianc@noddybox.demon.co.uk
Version 1.01 - Fixed bug whereby executables given with path prefixes are ignored - Added '-' argument for cd and pushd Version 1.0 - Initial release.
This software may be freely distributed providing no charge is made for it. If modified it must be distributed with the original copyrights, docs and sources intact along with any amendments.
$Id: scsh.html,v 0.10 1999/11/19 22:05:51 dosuser Exp dosuser $