+-----------+ | small CSH | +-----------+ scsh (c) Ian C C-shell type interface for MSDOS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ INDEX ÄÄÄÄÄ ù OVERVIEW ù USAGE ù INSTALLATION ù IMPORTANT NOTE ON ESCAPING ù COMMAND INPUT ù SMALL CSH ONLY COMMANDS ù SUPPORTED CSH COMMANDS ù UNSUPPORTED CSH COMMANDS ù SETS (shell variables) ù KNOWN BUGS ù BUG REPORTS ù CHANGE LOG ù COPYRIGHT ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ OVERVIEW ÄÄÄÄÄÄÄÄ scsh is a unix CSH style command line interface for MSDOS. Provides reasonably close csh command line functionality with these omissions and differences: ù Conditional and script commands are recognised, but ignored at the minute. The original idea was to provide an easy CSH interface, rather than a full CSH for use in scripting. This may change if I can re-engineer the parser to be a bit more friendly to a programming language. ù Job handling and background processing is not allowed - this is a restriction of DOS. Note that pipes still work by running commands sequentially, linked with redirected files, as do `capture` commands, eg. > echo `ls *.c | egrep [fb]` files foo.c bar.c files ù Subshells are not yet supported. eg. > (cd /source ; tar cf -) | (cd /dest ; tar xvf -) ù Normal CSH command line editing not yet implemented, but there is a full keyboard driven editor. ù Full range of history expansions not yet supported, and some of them a bit delicate. ù Parser not too clever. Doesn't support \X escapes. ù Alias parameter expansion is slightly easier due to the lazy parser - escape history and $ characters with single (') quotes. See the section IMPORTANT NOTE ON ESCAPING ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ USAGE ÄÄÄÄÄ scsh [options] [command [args]] Where options are : -b Stop interpreting command line arguments. Useful for passing switches to [command]. -c Read the first argument as a command. In the scsh this means that all files that are non-executable (ie. do not end in .com, .exe, etc) are treated as scsh scripts regardless of the presence of #/bin/[s]cshon their first line. -e Exit scsh if any command or built-in command returns a non-zero status. Note in the case of sequential or piped commands (eg. ls foo ; ls bar) only the last command has it's status checked. -f Do not read CSHRC and LOGIN on startup (see INSTALLATION) -i Forced interactive in CSH. In scsh forces reads from a basic stdin, disabling the PC specific based key reading and editing routine. -n Parse but do not execute commands. -s Take commands from standard input. In scsh forces reads from a basic stdin, disabling the PC specific based key reading and editing routine. -t Accept one command and then quit. -v Verbose. Entered commands are echoed after history substitution. -V Set verbose before reading CSHRC -x Echo. Entered commands are echoed just before execution and after all expansions. -X Set echo before reading CSHRC -L Force Small CSH to assume this is a login shell. See the section in INSTALLATIONto see what different actions are performed for a login shell. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ INSTALLATION ÄÄÄÄÄÄÄÄÄÄÄÄ 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 -Lswitch 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. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ IMPORTANT NOTE ON ESCAPING ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 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 alias E echo \!:1 set prompt='$user \!) ' becomes in scsh alias E 'echo !:1' set prompt='$user !)' 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 set prompt='$cwd !)' will work in the scsh. Note that the normal escape character (\) still works at the start of a command to disable aliasing. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ COMMAND INPUT ÄÄÄÄÄÄÄÄÄÄÄÄÄ Unless stdin mode (-s or -i) is selected scsh reads commands through a PC specific input routine that allows editing and recognises these keys: LEFT/RIGHT Move cursor along current line CONTROL LEFT/RIGHT Move cursor along current line in words. BACKSPACE/DELETE Delete character before/at cursor. CTRL DELETE Delete to end of line from cursor position. HOME/END Move to start/end of line. UP/DOWN Make the previous/next history item the current input. INSERT Toggle insert mode on/off. CTRL D If file name completion is on, list the files that match the word directly before the cursor. Typed at the start of an empty line it will act as an EOF character. ESCAPE If file name completion is on complete the word directly before the cursor. CTRL W Erase the previous word. CTRL U Empty the current line. CTRL Z If typed as the first character, acts as an EOF character. CTRL L Enters a none breaking space. eg. > ls /Program[CTRL L]Files/* ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SMALL CSH ONLY COMMANDS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ These commands are additional to the standard commands listed in the next section. .code Prompts for a key, then once pressed returns the code for that key to be used by the .key command. .key [keycode [string]] 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! .unkey [keycode] Without any argument removes all keycodes. Otherwise just removes the key definition for keycode. .version [-l] 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 -lwhen reporting bugs. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SUPPORTED CSH COMMANDS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ These csh commands are implemented in the following ways: : Null command. alias [name [def]] 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. break This command is parsed and then ignored in scsh currently. breaksw This command is parsed and then ignored in scsh currently. case [label:] This command is parsed and then ignored in scsh currently. cd [dir] chdir [dir]) 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). continue default: These commands are parsed and then ignored in scsh. dirs Prints the current directory stack, most recent first; the first being the current directory. echo [-n] list 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. eval argument Executes the argument, and then takes the output from the command and uses that as a command. exec command Execute command in place of the current shell. exit [n] Exits to the process which invoked scsh, returning a status code of n if passed, zero otherwise. foreach var (wordlist) ... end This command is parsed and then ignored in scsh currently. glob argument Performs wildcard expansion on argument. Resulting names are printed to stdout, separated by the nul character. goto label This command is parsed and then ignored in scsh currently. hashstat This command is parsed and then ignored in scsh currently. history [-hr] [n] 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 if (expr) command if (expr) then ... else if (expr2) then ... else ... endif This command is parsed and then ignored in scsh currently. limit [-h] 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. logout In scsh the equivilent of 'exit 0' popd [+n] 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). pushd [+n | dir] 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). rehash This commands is parsed and then ignored in scsh currently. repeat count command Repeat command count times. set [var [= value]] set var[n] = word 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. setenv [VAR [value]] 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. shift [var] 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. source [-h] file Reads commands from file. If -h is supplied the commands are added to history, but not executed. time [command] 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 switch (string) case label: ... breaksw ... default: ... breaksw endsw This command is parsed and then ignored in scsh currently. unalias pattern Discard aliases that match (filename substitution) pattern. All aliases are removed by unalias *. unhash This command is parsed and then ignored in scsh currently. unset pattern Remove variables whose names match pattern. All variables are removed by 'unset *' - this is not advisable! unsetenv variable Remove variable from the environment. Unlike unset no pattern matching is done. NOTE: This is currently unimplemented. while (expr) ... end This command is parsed and then ignored in scsh currently. @ [var =expr] @ [var[n] =expr] This command is parsed and then ignored in scsh currently. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ UNSUPPORTED CSH COMMANDS ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Aside from various commands, which are parsed and not yet implemented, these commands are parsed, but print a warning saying they are not supported : ù bg ù fg ù jobs ù kill ù login ù nice ù nohup ù notify ù onintr ù stop ù suspend ù umask ù unlimit ù wait ù % ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ SETS ÄÄÄÄ 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. cwd Your current directory. oldcwd Your previous directory. Initially the same as cwd on start up. echo If set then commands are echoed just before being executed and after all expansions have been done to the line. filec 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 fignore If set, the filenames ending in any of the set's listed extensions are omitted from filename completions. Defaults to (.o). fnconv If set then all '/' characters in the command line are converted to '\' characters, unless enclosed in single (') quotes. Defaults to being unset. history Setting this to a number defines who many of your previous commands are stored in the shell's history. savehist 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. home The users home directory. Initialised but not used by scsh, so unsetting or setting to different values has no effect. ignoreeof 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. noclobber If set redirecting out to a file that already exists; or doesn't exist if the redirection is an append; is an error. noglob Switch off wildcard expansion. eg. > echo * fred freda frog > set noglob > echo * * nonomatch 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 path 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= is done. pcedins 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. prompt 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) ' status The status code returned by the last command. user Your user name. Initialised but not used by scsh, so unsetting or setting to different values has no effect. verbose If set then the command line is echoed after history substitution has taken place. scshver Contains version number of scsh. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ KNOWN BUGS ÄÄÄÄÄÄÄÄÄÄ ù Filename completion sometimes destroys case. This is currently unavoidable due to the way DJGPP handles case significance while globbing files. ù Filename completion and globbing does not work with files beginning with a dot. ù After a while the shell may be unable to spawn new processes. This is a restriction of the Windows DMPI memory manager and is unavoidable. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ BUG REPORTS ÄÄÄÄÄÄÄÄÄÄÄ Mail problems (include the output from the .version -lcommand) or fixes to ianc@noddybox.demon.co.uk ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ CHANGE LOG ÄÄÄÄÄÄÄÄÄÄ Version 1.01 - Fixed bug whereby executables given with path prefixes are ignored - Added '-' argument for cd and pushd Version 1.0 - Initial release. ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ COPYRIGHT ÄÄÄÄÄÄÄÄÄ 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 $ =============================================================================== scsh.html converted to text by htot [$Revision: 0.12 $] (c) 1999 mailto:ianc@noddybox.demon.co.uk http://www.noddybox.demon.co.uk/