amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator) (04/17/91)
Submitted-by: umueller@iiic.ethz.ch Posting-number: Volume 91, Issue 090 Archive-name: shells/cshell-5.10/part03 #!/bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 6)." # Contents: csh.doc.ab csh.doc.ac # Wrapped by tadguy@ab20 on Tue Apr 16 15:34:35 1991 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'csh.doc.ab' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'csh.doc.ab'\" else echo shar: Extracting \"'csh.doc.ab'\" \(22783 characters\) sed "s/^X//" >'csh.doc.ab' <<'END_OF_FILE' X by Cursor-Up + RETURN). You will cycle through all directories X that matched the given abbreviation. The other possibility is to X specify the full name of the parent directory: cd devs/keym X You may also add devices and assigns, so if 'PageStream:' is one X line in the qcd-file, a cd to 'page' is successful. X X CD without any arguments displays the path of the directory you X are currently in. X X CLASS X Usage : [-n] name {type=param} [ "actions" {action=command} ] X Example : class zoo offs=20,dca7c4fd ext=.zoo actions view="zoo l" X X Defines a new class of files and the actions to be taken on them X in various cases, or shows old definitions if given no arguments. X See section XIV: OBJECTS X Options: X -n (new) forgets old definitions X X X CLOSE X Usage : close [filenumber] X X Close the specified file opened by open. Without filenumber, closes X all open files. See open and flist for more info. X X CLS X Usage : cls X X This is an alias. It only clears the screen, but also works on a X terminal (e ^L doesn't). X X COPY (CP) X Usage : copy [-udfpm] file file X or : copy [-udfpm] file1 file2...fileN dir X or : copy [-rudfp] dir1...dirN file1...fileN dir X X Options : X -r recursive, copy all subdirectories as well. X -u update, if newer version exists on dest, don't copy X -f freshen, if file doesn't exist on dest or newer, don't copy X -d don't set destination file date to that of source. X -p don't set destination protection bits to those of source. X -m erases the original. does not work with -r X X Example : copy -r df0: df1: X X Copy files or directories. When copying directories, the -r option X must be specified to copy subdirectories as well. Otherwise, only X top level files in the source directory are copied. X X All files will be displayed as they are copied and directory's X displayed as they are created. This output can be suppessed by X redirecting to nil: eg. copy -r >nil: df0: df1: X X Copy will abort after current file on Control-C. X X Copy by default sets the date of the destination file to that of X the source file. To overide this feature use the -d switch. X X Similarly, it sets protection bits (flags) to those of source and X any file comment will be copied. To avoid this use -p. The archive X bit is always cleared. X X Another useful option is the -u (update) mode were copy will not X copy any files which exists already in the destination directory X if the destination file is newer or equal to the source file. X This is useful when developing code say in ram: eg. 'copy *.c ram:' X when done you can copy -u ram: df1: and only those modules you have X modified will be copied back. X X Copy command will now create the destination directory if it does X not exist when specified as 'copy [-r] dir dir'. If you specify X copy file file file dir, then 'dir' must already exist. X X CP X Equivalent to copy. X X DATE X Usage : date [-sr] [new date and/or time] X Example : date Wednesday # this refers to NEXT wed, of course X X Used to read or set system date and/or time. All standard options X may be used (yesterday, tomorrow, monday, etc.). X Leading zero's are not necessary. X Without parameters shows Dddddd DD-MMM-YY HH:MM:SS. X Options: X -s stores the current time X -r shows time relative to last stored in secs and hunderths X X DEC X Usage : dec varname [value] X Example : dec abc X X Decrement the numerical equivalent of the variable with specified X value (default: 1) and place the ASCII-string result back into X that variable. X X DELETE (RM) X Usage : delete [-p][-r] file file file... X Example : delete foo.txt test.c X X Remove (delete) the specified files. Remove always returns X errorcode 0. You can remove empty directories. The '-r' option X will remove non-empty directories by recursively removing all sub X directories. X You can remove delete-protected files specifying -p option. X If you specify any wildcard deletes the files will be listed as X they are deleted. This can be suppressed by redirecting to nil: X X DIR (LS) X Usage : dir [-abcdfhiklnoqstuv] [-z lformat] [path path ... ] X Example : dir -ts downloads: X dir -lz "%7s %-.16n %m" *.c X Options: X -d list directories only X -f list files only X -h list only files which not start with a dot, end with '.info' or X have the h-flag set. X -s short multi(4) column display. X -c don't change colors for directories X -q quiet display. does not show length in blocks X -o display file nOtes X -n display names only X -p display full path names and suppress directory titles X -a shows the age of all files in the format days hours:minutes X -i identifies every file, shows the type instead of the date. X See chapter XIV CLASSES X -v (viewdir) recursively sums up lengths of the files in a dir X -l sorts the files by their length, longest first. X -t sorts the files by their time, most recent first. X -k sorts the files by their class (klass) X -b sorts the files backwards. X -g prints directories at the beGinning X -e prints directories at the End X -u must be given exactly two directories. Shows files only in X the first directory, files in both and files in the second. X -z custom format X X Displays a directory of specified files. Default output shows X date, protection, block size, byte size and total space used. X Protections flags include new 1.2/1.3 flags (see under protect), X plus a 'c' flag which indicates that this file has a comment. X Files are alphabetically sorted, without case sensitivity, and X directories are in red pen (unless you use -c). Dir takes in X account the width of your window. X X The lformat string is used to create your own directory format. X It will override all else. It may contain the following codes: X %a age %m multi column %t time X %b size in blocks %n name %u size in K X %c flag c (comment) %o file note %v dir size in eng X %d date %p name w/ path %w dir size in K X %f flags hsparwed %q name w/ slash %x translated date X %i flag d (dIr) %r size in eng X %k class %s size X Between the '%' and the identifying letter, there may be an optional X field width. If the number is preceded by a '-', the field contents X will be left adjusted. If by a dot, the contents will be cut down X to match the field width if they are longer. X If the format string contains a %m, cshell will try to print more X than one entry on one line. The column width is the field width of X the %m entry. If omitted, it's assumed to be the one of the first X file. If a file is longer, it will use two columns. X X DISKCHANGE X Usage : diskchange drive X X Like AmigaDOS diskchange. X X ECHO X Usage : echo [-en] string X Example : echo hi there X Results : hi there X X Echo the string given. If -n switch given no newline is X appended. If -e is on, echo to stderr. X X ELSE X Usage : else ; command X Usage : if -f foo.c ; else ; echo "Not there" ; endif X X Else clause, must follow an IF statement. X X ENDIF X Usage : endif X X The end of an if statement. X X Note: if you return from a script file with unterminated IF's X and the last IF was false, prompt will be changed to an X underscore ('_') and no commands will be executed until X 'endif' is typed. X X EXEC X Usage : exec command [args] X Example : set util SYS:sytem/utilities X exec $util/make # would not work without exec X X Execute the command specified; exec command is equivalent to X command, only you can use variables to specify command name. X Note that the command line is parsed TWICE, so the commands X set a dir ram:; exec $a # right X works fine, but X set a mkdir; exec $a "My directory" # wrong! X would create two directories. X X FAULT X Usage : fault error1 .. errorN X Example : fault 205 212 X X Like AmigaDOS fault, prints specified error messages. X X FILENOTE X Usage : filenote file1 .. fileN note X filenote -s file1...fileN X X The first form sets AmigaDOS comment of the specified file. X The second form display the file notes of the given files. X X FLIST X Usage : flist X X Lists the filenumbers of files opened by open. X See open and close for more info. X X FLTLOWER X Usage : fltlower X Example : dir | fltlower X Or : fltlower <readme X X This is a filter command, i.e. it reads from stdin and writes to X stdout. The more natural way to use it is a pipe, or it can be X redirected. X Its purpose is to convert all alphabetic to lower case. X X FLTUPPER X The same of fltlower, only this converts to upper case. X X FOREACH X Usage : foreach [-v] varname ( strings ) command X Example : foreach i ( a b c d ) "echo -n $i;echo \" ha\"" X Result : a ha X b ha X c ha X d ha X X 'strings' is broken up into arguments. Each argument is placed in X the variable 'varname' in turn and 'command' executed. To execute X multiple commands, place them in quotes. X X Foreach is especially useful when interpreting passed arguments in X an alias. X X eg. X foreach i ( *.pic ) viewilbm $i X assuming a.pic and b.pic in current directory the following commands X will occur: X viewilbm a.pic X viewilbm b.pic X X Flag -v causes arguments to be displayed every time command is X executed. X X FOREVER X Usage : forever command X or : forever "command;command;command..." X X The specified commands are executed over and over again forever. X X -Execution stops if you hit ^C X -If the commands return with an error code. X X FORLINE X Usage : forline var filename command X or : forline var filename "command;command..." X Example : forline i RAM:temp "echo line $_linenum=$i" X X For each ASCII line of file specified commands are executed and X var points to line content. You can check system variable _linenum X to find the number of the line currently read. X If STDIN (case sensitive) is specified as input file, the lines are X read from standard input. X X FORNUM X Usage : fornum [-v] var n1 n2 command X or : fornum [-v] -s var n1 n2 step command X Example : fornum -v x 1 10 echo $1 X or : fornum -s x 10 1 -1 echo $i # counts backwards X X Executes command(s) for all numerical values of x between n1 and X n2. If more than one command is specified, or command is X redirected, include command(s) in quotes. X Switch -v (verbose) causes printing of progressive numbers. X Switch -s allows you to specify a step; if this is negative, the X count will be backwards. X X GETENV X Usage : getenv [shellvar] envvar X X Gets the value of an ARP or ENV: variable (ARP list searched first) X and stores it in the shell variable 'shellvar'. If shellvar is X omitted, the value of the ENV: variable is printed to stdout. X X GOTO X Usage : goto label X Example : X label start X echo "At start" X dir ram: X goto start X X Goto the specified label name. You can only use this command from X a source file. Labels may be forward or reverse from current X position. It is legal to jump out of if's. X X HEAD X Usage : head filename [num] X Example : head readme 20 X X Display first "num" lines of "filename". If num is not specified, X 10 is assumed. X X HELP X Usage : help X Example : help X X Simply displays all the available commands. The commands are X displayed in search-order. That is, if you give a partial name the X first command that matches that name in this list is the one X executed. Generally, you should specify enough of a command so X that it is completely unique. X X HISTORY X Usage : history [partial_string] X Example : history X X Displays the enumerated history list. The size of the list is X controlled by the _history variable. If you specify a partial X string, only those entries matching that string are displayed. X X HOWMANY X Usage : howmany X X This command tells you how many instances of Shell are running in X your system. X X HTYPE X Usage : htype file1 .. filen X X Displays the specified files in hex and ASCII, just like the system X command Type file opt h. Especially suitable for binary files. X X IF X Usage : if [-n] argument conditional argument ; X or : if [-n] argument X or : if [-n] -f file X or : if [-n] -d file/dir X or : if [-n] -m X or : if [-n] -t file file1 .. fileN X or : if [-n] -r rpnexpression X or : if [-n] -v varname X X If a single argument is something to another argument. Conditional X clauses allowed: X X <, >, =, and combinations (wire or). Thus <> is not-equal, >= X larger or equal, etc... X X If arguments are not numeric, they are compared as strings. X X Usually the argument is either a constant or a variable ($varname). X X The second form if IF is conditional on the existance of the argument. X If the argument is a "" string, then FALSE, else TRUE. X X The third form of IF used by -f switch checks for existance of X the specified file. X X Switch -d tests the type of the object specified: if it is a X directory, then TRUE; if it is a file (or it doesn't exist) X then FALSE. X X Switch -m is used to test if FAST memory is present. X Example (to be included in a login.sh file): X if -m; resident -d lc1 lc2 blink; endif X X Using -t form compares the date and time of the first file with X all the others; if the first is younger than ALL the others, then X FALSE, else TRUE. If a file doesn't exists, it is considered as X being older. X This feature is especially useful for building makefiles without X using any MAKE utility. X Example: X if -t test.o test.asm test.i ; asm -o test.o test.asm ; endif X X Option -r evaluates a given RPN expression (see under RPN for more X info): if value on top of stack is 0, then FALSE, else TRUE. X X Switch -n (NOT) reverses the result. X X To test if a given variable is defined, use if -v varname. X X When using 'IF' command interactively if you are entering commands X following an 'IF' that was false, the prompt will be set to a X underscore '_ ' to indicate all commands will be ignored until X an 'ELSE' or 'ENDIF' command is seen. X X INC X Usage : inc varname [value] X Example : inc abc 5 X X Increment the numerical equivalent of the variable with specified X value (default: 1) and place the ascii-string result back into X that variable. X X INFO X Usage : info [path1 path2 ... pathN] X X If called without arguments, info gives you the drive information X on all devices. If one or more paths are specified, only infor- X mation on those drives will be displayed. X X INPUT X Usage : input [-s] var var ... var X Example : input abc X X Input from STDIN (or a redirection, or a pipe) to a variable. The X next input line is broken up in words (unless quoted) and placed in X the variable. If -s is turned on, the whole line is read in as one X word, including spaces. -r puts the console to single character mode X before reding. X X JOIN X Usage : join [-r] file1..fileN destfile X Example : join part1 part2 part3 total X X Joins the specified files to get destfile. If destfile already X exists, an error message is generated and operation is aborted, X unless you specify -r (replace) option. X X KEYMAP X Usage : keymap number {key=function} X Example : keymap 0 1030=4 1032=12 X X Defines one keymap for the cshell command line editing. See chapter X XV. X X LABEL X Usage : label name X X Create a program label right here. Used in source files, can then X GOTO a label. X X LINECNT X Another filter. Counts the number of lines of its stdin and writes X it to stdout. X X LOCAL X Usage: local [var...var] X X Creates one or more local variables. Those variables disappear at X at the end of their alias or source file, and cannot be accessed X from inside other aliases or source files. X With no arguments, shows all local variables and their values. X X LS X Equivalent to dir. X X MD X Equivalent to mkdir. X X MAN X Usage : man command(s) X Example : man mkdir X X Get info about a Shell command, or others keywords. These include X all special _variables, plus various keywords: WILDCARDS, PIPES, X EDITING, STARTUP and more. X See special alias manlist to get a list of ALL keywords supported X by man. X You must set _man to the paths of your .doc files: X set _man dh1:docs/aliases.doc dh1:docs/csh.doc X X To create your own .doc files, precede all your keywords by four X blanks. 'man' will then display lines until the first character X of a line is alphanumeric or has four leading blanks. X X MEM X Usage : mem [-cfqu] X X Options: X -c shows the free chip mem only X -f shows the free fast mem only X -q outputs just a number without titles X -s stores current free memory X -r shows memory used relative to last stored X X MENU X Usage : menu [-n] [ title item...item ] X Example : menu Shell JrComm,,j Rename,"rename ",r quit X X Appends one pull down in the current console window. Up to six X menus with 16 items every can be installed. X X If the item is just a string, that string will be in the menu item. X When you select it, it will be put into the prompt and executed. X X If there is a comma and after that comma a second string, this X will be the command will be inserted at the prompt. This time you X have to add the ^M yourself if you want the command to be executed. X X If there is a second comma, the letter after that comma will be X the keyboard shortcut for that menu item. (This will be case X sensitive some day, use lowercase). X X If for any reason your current menu is corrupt, just enter an X empty 'menu' command. X X To clear all existing menus use option -n. X X MKDIR (MD) X Usage : mkdir name name name... X Example : mkdir df0:stuff X X Create the specified directories. X X MV X Equivalent to rename. X X OPEN X Usage : open filename filemode filenumber X Example : open RAM:data w 1 X X This allows you to open a file, redirect to it as many commands as X you like, then close it. X Filename is any valid AmigaDOS filename, filemode is either "r" for X read or "w" for write, filenumber is a number between 1 and 10. X To redirect a program to or from an open file, use as your redir X filename a dot followed by the filenumber. X Here is a complete example: X X open RAM:data w 1 X echo -n 2+2= >.1 X rpn 2 2 + . CR >.1 X close 1 X type RAM:data # will display 2+2=4 X X See also close, flist. X X PATH X Usage : path [-r] [dir...dir] X X Without arguments, lists AmigaDOS path. Otherwise adds given directories X to the path, preventing duplicate entries. X Options: X -r Resets the path X X PRI X Usage : pri clinumber pri X Example : pri 3 5 # set priority of cli #3 to 5 X X Change the priority of the specified task (use PS command to X determine clinumber). If you specify 0 as clinumber you can X change priority of "this" task (the one executing shell). X X PROTECT X Usage : protect file1 ... filen [+|-|=][flags] X Example : protect myfile +rwe X X Set AMIGADOS file protection flags for the file specified. Valid X flags are h, s, p, a, r, w, e, d. Modes: X + Set specified bits, leave all others X - Clear specified bits, leave all others X = Set specified bits, clear all others X Specifying no mode is equal to '='. Archive bit cleared by default. X X PS X Usage : ps [commandname...commandname] X X Gives status of CLI processes. eg: X X Proc Command Name CLI Type Pri. Address Directory X * 1 csh Initial CLI 0 97b0 Stuff:shell X 2 clock Background -10 2101a8 Workdisk: X 3 emacs Background 0 212f58 Stuff:shell X 4 VT100 Background 0 227328 Workdisk: X X Address is the address of the task, directory is the process X currently CD'd directory. My default, only the BaseNames of X the commands are shown. Your own CLI will be marked by an X asterisk in the first column. X Options: X -l shows full pathnames of commands X -e excludes the given command names from the list X X PWD X Usage : pwd X X Rebuild _cwd by backtracing from your current directory. X X QSORT X Usage : qsort [-r] <in >out X X Quick sorts from stdin to stdout. -r causes reverse sorting. X X QUIT X Usage : quit X X Quit out of Shell back to CLI. X X RBACK X Usage : rback command X X Start a new process executing the specified command, but can't do X input/output. Equivalent to 'run command >NIL: <NIL:'. Instead of X using rback, you can add a '&' at the end of the command line. The X variable $_newproc will hold the cli number of the newly created X process. X Note: rback cannot start builtin commands. You have to start a X subshell: rback csh -c "copy ram:temp prt:;rm ram:temp X X READFILE X Usage : readfile varname [filename] X X Completely reads a (short!) ascii file and assigns it to a variable. X Each line becomes one word in the resulting string. Embedded blanks X are no problem. If file name is omitted, stdin is used. X X RENAME (MV) X Usage : rename from to X or : rename from from from ... from todir X X Allows you to rename a file or move it around within a disk. X Allows you to move 1 or more files into a single directory. X The archive bit of the file(s) will be cleared. X X RESIDENT X Usage : resident [-r][-d] [files] X Example : resident lc1 lc2 blink # load these as resident X resident -d lc1 lc2 blink # defer load when needed X resident -r lc1 lc2 blink # remove these X resident # list resident programs X X This is ARP resident. Commands are searched by Shell in resident X list BEFORE of searching on any external device. X Only PURE programs can run as resident, see ARP docs for more info. X Option -d is very useful: you can say, in your startup file, X resident -d file...file; programs will not be loaded immediately, X but only when you will try to load them. This way, you will not X waste memory and startup time if you don't use the programs. X Old option -a has no more effect. X X RETURN X Usage : return [n] X Example : return 10 X X Exit from a script file, or quit from shell with optional X exit code. X X RM X Equivalent to delete. X X RPN X Usage : rpn expression X Example : rpn 3 7 * # Prints the value 21 X X Evaluate an RPN expression, using 32-bit values. In older versions X of Shell RPN contained string functions too, but now that strings X are handled by specifical commands, these are no more needed. X At end of evaluation, RPN prints values on stack, so you can X say for instance "rpn $x 2 * | input x" to double the value of X variable x. X Functions implemented are: X X + - * / Obvious meaning; / means integer division, of course X % Module operator e.g. "rpn 7 3 %" answers 1 X & | ~ Bitwise and, or, not operators X > < == Tests for greater-than, lower-than, equal. To get X a test for >= (or <=), you can use < ! (or > !) X ! Logical not operator X DUP Duplicate value on top of stack X DROP Drop value on top of stack X SWAP Swap two values on top of stack X X To avoid confusion with redirections, > and < operators must be X enclosed in quotes e.g. X X 3 2 ">" # Prints 1 X X RUN X Usage : run prgm args X Example : run emacs test.c X X Start a new process executing the specified command. X In current implementation run command can't be redirected. X This command is not fully reliable: use at your own risk. X $_newproc will hold the cli number of the new process. X See also rback. X END_OF_FILE if test 22783 -ne `wc -c <'csh.doc.ab'`; then echo shar: \"'csh.doc.ab'\" unpacked with wrong size! fi # end of 'csh.doc.ab' fi if test -f 'csh.doc.ac' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'csh.doc.ac'\" else echo shar: Extracting \"'csh.doc.ac'\" \(23279 characters\) sed "s/^X//" >'csh.doc.ac' <<'END_OF_FILE' X RXREC X Usage : rxrec [portname] X X Create an AREXX-compatible port of the specified name (defaults to X "rexx_csh"), then puts Shell to sleep waiting for messages on it. X X CAUTION: the only way to exit from this status is to send to the port X the message "bye". X X Example: X Open two Shell's in two separate CLI's. From the first, type: X X rxrec X X Now first Shell doesn't respond to keyboard input; instead, it waits X for messages on a port called "rexx_csh". Now, from the other, type: X X rxsend rexx_csh "dir df0:" X X You will see the listing of df0: in the first Shell. Experiment as you X like, then: X X rxsend rexx_csh bye X X And all will return to normal. X X RXSEND X Usage : rxsend [-lr] portname command...command X X Send commands to any program with an AREXX-compatible port. Be aware X that every word is sent as a single command! X X You don't have to load anything to use these command (or rxrec): X all you need is a program with the right port. X X An example is CygnusEdProfessional: here is, for instance, a command X to wake it up, load the file test.c and jump to line 20: X X rxsend rexx_ced cedtofront "open test.c" "jmp to line 20" X # rexx_ced is the name of AREXX port for CygnusEd X X The option -r sets the variable _result to the result string X of the AREXX command. X The option -l send the whole line as *one* command. X X Refer to your application manual for details and for the names X of the commands and the port. X X SEARCH X Usage : search [-abcefnqrvw] file...file string X X Search specified files for a string. Only lines containing the X specified strings are displayed. X X If the filename is STDIN (in uppercase), the standard input is X used, so you can use search as the destination for a pipe. X Example: X strings myprog 8 | search STDIN .library X Lists all libraries used in "myprog". X X Search is very fast if none of the options -w, -e and STDIN was X specified and the file fits into memory. X X Options: X -a (abort) stops search as soon as the pattern was found once X -b (binary) shows only byte offsets instead of lines. If combined X with -n, shows naked numbers. X -c (case) turns ON case sensitivity X -e (exclude) lists lines NOT containing the pattern X -f (files) causes only the names of the files in which the pat- X tern was found to be displayed. X -l (left) pattern must be at beginning of line (this is faster X than using a wild card) X -n (number) turns off line numbering X -o (only) finds only whole words X -q (quiet) suppresses printing of file names. X -r (recurse) if you specify any directory, all files in that di- X rectory are recursively searched. X -v (verbose) shows each file name on a single line. this is auto- X matically turned on if search is redirected X -w (wild) wild card matching. see notes below X X Notes to wild card matching; X - Uses Shell standard matching. X - All standard ARP wildcards are allowed * ? [] () | ~ ' # X - The WHOLE line must match the string, not only a substring. X - String MUST be enclosed in quotes to avoid wildcard expansion X X Examples: X search -cr df0:include ACCESS X Find all occurrencies of ACCESS (in uppercase) in all files X contained in include directory. X search -w shell.h "'#define*" X Lists only lines of file beginning with (not simply containing) X #define. Note the use of ' to escape the special symbol #. X X SET X Usage : set [name] [string] X Example : set abc hello X X Set with no args lists all current variable settings. X Set with one arg lists the setting for that particular variable. X Specifying name and string, stores the string into variable name. X X Also See the section on special _variables. X X SETENV X Usage : setenv envvar value X X Sets an ENV: variable to the given value. The value must be X enclosed in quotes if it contains spaces. X X SLEEP X Usage : sleep timeout X Example : sleep 10 X X Sleep for 'timeout' seconds, or until ^C typed. X X SPLIT X Usage : split srcvar dstvar...dstvar X X Assigns one word of srcvar to every dstvar, the rest of srcvar to X the last dstvar. X Note: You enter variable NAMES, not variables. X X STACK X Usage : stack [number] X Example : stack 8000 X X Changes the default stack for this CLI. Without arguments, prints X it. X X STRHEAD X Usage : strhead varname breakchar string X Example : strhead x . foobar.bas # Will set x to "foobar" X X Remove everything after and including the breakchar in 'string' and X place in variable 'varname'. X X STRINGS X Usage : strings file1..fileN minlenght X Example : strings c:dir c:list shell 7 X X Prints strings contained in specified files (usually binary) X with lenght >= minlenght. X X STRLEFT X Usage : strleft varname string n X Example : strleft x LongString 5 # Will set x to "LongS" X X Place leftmost n chars of string in variable varname. X X STRLEN X Usage : strlen varname string X Example : strlen x Hello # Will set x to "5" X X Puts len of string in variable varname. X X STRMID X Usage : strmid varname string n1 [n2] X Example : strmid x LongString 5 3 # Will set x to "Str" X X Places n2 chars from string, starting at n1, in variable varname. X By omitting n2, you get all chars from n1 to end of string. X X STRRIGHT X Usage : strright varname string n X Example : strright x LongString 5 # Will set x to "tring" X X Place rightmost n chars of string in variable varname. X X STRTAIL X Usage : strtail varname breakchar string X Example : strtail x . foobar.bas # Will set x to "bas" X X Remove everything before and including the breakchar in 'string' and X place in variable 'varname'. X X SOURCE X Usage : source file [arguments] X Example : source mymake.sh all X Result : barch file 'mymake.sh' called with var _passed = 'all' X X Execute commands from a file. You can create SHELL programs in X a file and then execute them with this command. Source'd files X have the added advantage that you can have loops in your command X files (see GOTO and LABEL). You can pass SOURCE files arguments X by specifying arguments after the file name. Arguments are passed X via the _passed variable (as a single string, a set of words). X X Long lines may be split by appending a backslash (\) at end of X first part. One single line must be shorter than 512 bytes, but X the concatted line can be as long as you want. There is no limit X on the length of the concatted line. X X Automatic 'sourcing' is accomplished by appending a .sh suffix to X the file and executing it as you would a C program: X X --------- file hello.sh --------- X foreach i ( $_passed ) "echo yo $i" X --------------------------------- X X $ hello a b c X yo a X yo b X yo c X X If the last character of a line in a source file is '{', all X following lines will appended to the current one and separated X by semicolons until the last character of a line is '}'. Those X blocks may be nested. X X --------- file login.sh --------- X alias complex { X echo -n "this alias " X echo "works!" X } X --------------------------------- X X $ login X $ complex X this alias works! X X X TACKON X Usage : tackon var pathname filename X Example : tackon x df0:c Dir # sets x to "df0:c/Dir" X or : tackon x df0: Preferences #sets x to "df0:Preferences" X X Correctly adds a filename to a pathname, and puts the result in X variable specified. X X TAIL X Usage : tail filename [num] X Example : tail readme 20 X X Display last "num" lines of "filename". If num is not specified, X 10 is assumed. X X TEE X Usage : tee [file] X Example : cc test.c | tee >error.list X X Copies stdin to stdout and the given file. If file is omitted, sterr X is used. X X TOUCH X Usage : touch file1 .. fileN X X Sets DateStamp of the specified files to the current date & resets X archive bit. X X TRUNCATE X Usage : truncate [n] X Example : alias | sort | truncate X X A filter that truncates the width of stdin to the specified number, X trying to account for tab's and escape sequences. If the number is X omitted, the current window width is used. X X TYPE X Equivalent to CAT. X X UNALIAS X Usage : unalias name .. name X Example : unalias vt X X Delete aliases.. X X UNIQ X Usage : uniq X X This is a filter that removes consecutive, duplicated lines in a X file. It is most useful on a sorted file. X X UNLOCAL X Usage : unlocal var ... var X X Deletes one or more local variables X X UNSET X Usage : unset name .. name X Example : unset abc X X Unset one or more variables. Deletes them entirely. X X USAGE X Usage : usage [command...command] X X If called without arguments, usage gives you a short information X on the special characters used. Otherwise, usage shows you the X usage of the given commands. Calling a command with a '?' as X the only argument will show its usage, too. X X VERSION X Usage : version X X Show current version name, & authors. X X WAITFORPORT X Usage : waitforport portname [seconds] X X Waits for a port to come up. Default time is 10 seconds. X X WHEREIS X Usage : whereis [-r] filename [ device1...deviceN ] X X If just a file name is given, cd searches all subdirectories of the X current directory for that file. An asterisk '*' is appended to the X file. Wild cards are allowed for the file (no asterisk will be X appended then ), but no path names. If additional arguments are X given, whereis searches only these paths, not the current directory. X whereis -r looks on all drives. X X WINDOW X Usage : window [-q][-f][-b][-l][-s] [dimensions] X Options : X -f (front) Window to front X -b (back) Window to back X -l (large) Window to maximum size X -s (small) Window to minimum size X -a (activate) X -q (query) Lists screens and windows open X X Various operations on CLI window. If dimensions are specified, X they must be in the form x y width height, with values separated by X spaces. X The command "window -l" may be very useful on PAL machines to X get a full PAL window from your login sequence, or if you use X overscan WorkBench. X Option -q gives, for each Screen and Window currently open, X title, left edge, top edge, width, height. X X XIX. SPECIAL SET VARIABLES X------------------------- X X _abbrev X If set to 'n', internal commands can no longer be abbreviated. X X _bground X True if the shell was started with a non-interactive input. X X _clinumber X Contains the number (1-20) of current CLI. X X _cwd X Holds a string representing the current directory we are in from X root. The SHELL can get confused as to its current directory if X some external program changes the directory. Use PWD to rebuild X the _cwd variable in these cases. X X _debug X Debug mode... use it if you dare. must be set to some value X X _every X Contains the name of a command that is output every time just before X the prompt is printed. Do not use this to echo the prompt. X X _except X See EXCEPTION X X _hilite X Holds the font attributes used for highlighting. One letter for one X attribute: X b for bold X i for italic X u for underlined X r for reverse X c3 for foreground color 3 X c3,2 for foreground color 3 and background color 2 X Any combinations are allowed. _hilite defaults to "c7", in terminal X mode to "r". X X _history X This variable is set to a numerical value, and specifies how far X back your history should extend. Set it to 0 to disable history, X for example if you test your programs for memory leaks. Defaults X to 50. X X _insert X Sets the default for insert/overtype mode for command line X editing. ^A toggles between, but after <RET> the default is X set back as indicated by this variable. By default _insert is 1 X indicating insert mode on setting to zero will make overtype X the default. X X _ioerr X Contains the secondary error code for the last command. Will be X changed after every external command and after a failed internal X command. See @ioerr( ) X X _kick2x X True if dos.library V36 could be opened (which means that kickstart X 2.0 is around) X X _lasterr X Return code of last command executed. This includes internal X commands as well as external comands, so to use this variables X you must check it IMMEDIATELY after the command in question. X X _lcd X Holds the name of the last directory. The builtin alias 'dswap' X cd's to that directory. If called again, you're back where you X were. X X _man X The path and name of your .doc file. Defaults to 'csh:csh.doc' X X _maxerr X The worst (highest) return value to date. To use this, you usually X set it to '0', then do some set of commands, then check it. X X _minrows X Gives the minimum number of rows a window must have to turn on quick X scrolling. Defaults to 34. X X _nobreak X If set to some value, disables CTRL-C. X X _noreq X If set to some value , disables system requesters ("Please insert X volume ...."). Turned on in vt200 mode. X X _passed X This variable contains the passed arguments when you SOURCE a file X or execute a .sh file. For instance: X X test a b c d X X -------- file test.sh ---------- X echo $_passed X foreach i ( $_passed ) "echo YO $i" X -------------------------------- X X _path X Tells CShell where to look for executable files. The current direc- X tory and the AmigaDOS path will be searched first. The trailing X slash for directories is not necessary anymore. The entire path X will be searched first for the <command>, then for <command>.sh X (automatic shell script sourcing). Example: X set _path ram:c,ram:,sys:system,dh1:tools,df0:c X (This path has the advantage that these directories need not even X exist, that you can access devices (AmigaDOS path only knows X volumes under Kick 1.3) and that no disk seeks happen at startup) X X _prompt X This variable now can contain the following control characters: X %c for color change. This highlights your prompt. See _hilite X %m for memory. This shows your current memory in K X %t for time. This shows your current time in the format HH:MM:SS X %d for date. This shows the current date in the format DD-MMM-YY X %p for path. This inserts the current path X %n for number. This inserts the current process number X %v for version. This shows the version number of CShell X %h for history. This displays the current history number X %f for free store. This shows the free store on the current drive X %r for pRiority. Inserts the task priority of the current X The default for prompt is now "%c%p> " X The if command will set the prompt to a '_ ' if commands are X disabled while waiting for a 'endif' or 'else' command (interactive X mode only. X X _pipe X The directory where temporaries are stored. Default: 'T:' X X _qcd X Holds the name of the file where the all directories on your hard X disk are stored. If not set, defaults to csh:csh-qcd. X X _rxpath X The same as with _path, but this is where CShell looks for .rexx X files. Defaults to REXX: X X _scroll X Holds the number of lines to be scrolled at once when quick scrolling X is used. If unset or <=1, quick scrolling is off. Defaults to 3. X X _terminal X Indicated whether or not shell was started in terminal mode. X X _titlebar X The same control characters as for the _prompt can be used for X _titlebar, too. The only difference is that %c is ignored. The X titlebar is updated every time before the prompt appears. X X _verbose X If set to 's', turns on verbose mode for source files (every command X will be displayed before being executed). If set to 'a', displays X all substeps while alias substitution. 'h' will hilight the debug X output. Any combination allowed: set _verbose sah X X _version X Contains the version number of the shell, e.g. 510. X X XX. FUNCTIONS X-------------- X X FUNCTIONS X Functions are preceded by an @-sign and may not be abbreviated X They must be preceded by a blank amd a blank must follow the opening X and precede the closing brace. There must be no blank between the X function name an the opening brace. X (NOTE: Later versions of Shell might allow that functions need not X be at the beginning of an argument, so quote any @-signs not X used for functions) X X Functions may be nested. The function names themselves are case X sensitive, but the operations (like strcmp) aren't. X X Functions can be used as commands. They will echo their return value X to stdout. Note that they can't be abbreviated and that the function X list is searched after the command list. Example: X drives ---> DF0: DH1: DH2: RAM: WB_2.x: X X So far, functions are not user definable. X X Note the difference between sets of words and strings. After X set var hello world X $var is a wordset, but after X set var "hello world" X var is one string. Although they look the same if echoed, they X behave different, for example in 'foreach i ( var ) "echo hi'. The X functions @split and @concat convert the two forms. X X X @abbrev( str1 str2 [len] ) X true if the first <len> chars of str1 are an abbreviation of str2 X @abs( num ) X returns absolute value of <num> X @age( file ) X the age of that file in days, 99999 if file not found X @appsuff( name suffix ) X appends an suffix ( .ZOO ) to a string if it's not already there X @availmem( [type] ) X returns free 'chip', 'fast' or otherwise total memory X @basename( file ) X returns the file name of <file> without path X @center( word len ) X returns a string of length <len> with <word> centered in it X @checkport( portname ) X indicates if given port exists X @clinum( procname ) X returns the number of the cli identified by a name or a number X @complete( abbrev word ... word ) X returns the first word <abbrev> is an abbreviation of X @concat( word word ... word ) X concats all words in one blank separated string, see @split X @confirm( title item ... item ) X asks for confirmation of every item and returns the confirmed ones X @console( STDIN|STDOUT ) X tells whether stdin or stdout are interactive (not redirected) X @dectohex( number ) X returns a string representing <number> in hex X @delword( word word ... word n ) X returns a string with the n-th word deleted. X @delwords( word word ... word n m ) X deletes the next m words from the n-th. X @dirs( name name name name ) X returns the directories among the given file names, see @files X @drive( path ) X outputs the drive ( device ) name associated to <path> X @drives( ) X outputs all available drives X @exists( file ) X tells whether a file exists or not X @fileblks( file file ... file ) X returns the # of blocks needed for the files, incl. dir blocks X @filelen( file file ... file ) X count the total number of bytes of the given files X @fileprot( file ) X returns a string like ---arwed X @filereq( title path&pattern filename ) X brings up the arp file requester and returns the selected file name X @files( file file ... file ) X gives you the files among those names, no directories. see @dirs X @freebytes( path ) X the number of free bytes on the given path X @freeblks( path ) X the number of free blocks on the given path X @freestore( path ) X the amount of free store on that path, given in K, M and G X @getenv( varname ) X returns the value of the named env: variable X @getclass( file ) X returns the class (type) of the file. See chapter XIV X @howmany X indicates the # of shells running X @index( string pattern ) X returns the index of pattern in string (starting at 1), 0 if not found X @info( path ) X the corresponding line from the 'info' command, each entry a word X @intersect( word1 word2 word3 , word4 word5 word6 ) X returns all words which are in both lists. see @union, @member X @ioerr( num ) X returns the corresponding error string to num X @lookfor( file paths ) X looks for a file in the current directory and the paths. See $_path X @lower X lowercases its arguments. see @upper X @match( word ... word "pattern" ) X returns the words in the list that match the arp-pattern X @max( num num ... num ) X computes the maximum of all given numbers X @megs( number ) X expresses a number in K, M and G (-bytes), rounded correctly X @member( word1 word word ... word ) X tells you if word1 is among the remaining words X @min( num num ... num ) X computes the minimum of all given numbers X @mounted( device ) X returns a boolean indicating whether the specified device is mounted X @nameext( filename ) X returns all after the last dot of <filename>. X @nameroot( filename ) X returns all before the LAST dot of <filename>. X @pathname( path ) X strips the base name from a path X @pickargs( arg ... arg ) X picks of its arguments those which don't start with a '-' X @pickopts( arg ... arg ) X picks of its arguments those which start witch a '-' X @rpn( expression ) X computes the rpn expression. See rpn command X @sortargs( name ... name ) X sorts its arguments alphabetically X @sortnum( number ... number ) X sorts its arguments numerically X @split( string ) X makes each blank separated part of @string a word, see @concat X @strcmp( name name ) X returns -1, 0 or 1 depending of alphabetical comparison X @strhead( breakchar string ) X see strhead command X @strleft( string number ) X see strleft command X @strmid( string n1 n2 ) X see strmid command X @strright( string n ) X see strright command X @strtail( breakchar string ) X see strtail command X @subwords( word ... word n m ) X returns the next m words word of the given list starting from n X @tackon( path file ) X see tackon command X @unique( word ... word ) X sorts the arguments and makes each of them unique X @union( name ... name , name ... name ) X returns all names that are in either list. See @intersect, @member X @upper( word ... word ) X upper cases the given words. see @lower X @volume( path ) X returns the volume name in that path or "" (no colon appended) X @winheight( ) X outputs the height of your window in pixels X @winleft( ) X returns the left edge of your window X @wintop( ) X returns the top edge of your window X @winwidth( ) X outputs the width of your window in pixels X @without( name ... name , name ... name ) X returns all names of list 1 that are not in list 2 X @word( name ... name n ) X picks the n-th word from the list. X @words( name ... name ) X returns the number of words in the list. X X XXI. MISCELLANEOUS X----------------- X X QUICK SCROLLING X CShell has now allows to do quick scrolling in large windows. X Quick scrolling means that whenever the cursor reaches the bottom X of the window, the text jumps up 3 or more lines at once. However, X only the following commands support this (yet): X - dir, cat, htype, strings, search, truncate, tee X You can choose the number of lines to scroll at once by setting X the variable _scroll. Unsetting it or setting it to a value <=1 X completely disables quick scrolling. X You can also choose the number lines a window must at least have X to turn on the quick scrolling by setting the _minrows variable. X (Defaults to 34). Quick scrolling is automatically disabled when X the command is redirected. By piping any command to cat, you can X force it to quick scroll. Example: List | cat X X X CLOSING GADGET X CShell now can be terminated using the closing gadget in the X AmigaDOS 2.0 shell window. Don't execute c:ENDCLI while using X the shell. This can cause problems with external commands. The X closing button provides a 'quit' command. You can define X alias quit "Endcli;\\quit X to assert that the CLI window closes when you click the button. X X X EXCEPTION PROCESSING END_OF_FILE if test 23279 -ne `wc -c <'csh.doc.ac'`; then echo shar: \"'csh.doc.ac'\" unpacked with wrong size! fi # end of 'csh.doc.ac' fi echo shar: End of archive 3 \(of 6\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 5 6 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 6 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mail submissions (sources or binaries) to <amiga@uunet.uu.net>. Mail comments to the moderator at <amiga-request@uunet.uu.net>. Post requests for sources, and general discussion to comp.sys.amiga.misc.