📄 ckututor.txt
字号:
Equivalent to SET DUPLEX HALF, SET HANDSHAKE XON. -v arg N Window size for Kermit protocol (ignored when streaming). Equivalanet to SET WINDOW-SIZE. Argument: Number, 1 to 32. -w N Incoming files Write over existing files. Equivalent to SET FILE COLLISION OVERWRITE. -x Y Enter server mode. Equivalent to the SERVER command. Also see: -O. -y arg N Alternative initialization file. Argument: Filename. -z N Force foreground behavior. To be used in case Kermit doesn't automatically sense its foreground status. Equivalent to the SET BACKGROUND OFF command. Extended command-line options (necessary because single-letter ones are about used up) start with two dashes (--), with words rather than single letters as option names. If an extended option takes an argument, it is separated from the option word by a colon (:). Extended options include: Option Description --bannerfile:filename File to display upon startup or IKSD login. --cdfile:filename File to be sent for display to the client when server changes directory (filename is relative to the changed-to directory). --cdmessage:{on,off} Enable/disable the server CD message feature. --help Prints usage message for extended options. --helpfile:filename Designates a file containing custom text to replace the top-level HELP command. --nointerrupts Disables keyboard interrupts. --noperms Disables the Kermit protocol file Permissions attribute, to prevent transmission of file permissions (protection) from sender to receiver. Plus several other [58]IKSD-Only options. See the [59]file-transfer section for examples of command-line invocation. ________________________________________________________________________ COMMAND LANGUAGE [ [60]Top ] [ [61]Contents ] [ [62]Next ] [ [63]Previous ] * [64]Command Files, Macros, and Scripts * [65]Command List C-Kermit's interactive command language is the subject of a [66]622-page book and another several hundred pages of updates, far too much for a manual page. But it's not hard to get started. At the shell prompt, just type "kermit" to get C-Kermit's interactive command prompt: $ kermit (/current/directory) C-Kermit> Begin by typing "help" (and then press the Return or Enter key) for a top-level overview, read it, and go from there. Your second command should probably be "intro" (introduction). Note the prompt shows your current directory (unless you tell Kermit to prompt you with something else). Interactive commands are composed mainly of regular English words, usually in the form of imperative sentences, such as: send oofa.txt which tells Kermit to send (transfer) the file whose name is oofa.txt, or: set transfer mode automatic which sets Kermit's "transfer mode" to "automatic" (whatever that means). While typing commands, you can abbreviate, ask for help (by pressing the "?" key anywhere in a command), complete keywords or filenames (with the Tab or Esc key), and edit your typing with Backspace or Delete, Ctrl-W, Ctrl-U, etc. You can also recall previous commands, save your command history, and who knows what else. Give the INTRO command for details. C-Kermit has hundreds of commands, and they can be issued in infinite variety and combinations, including commands for: * Making connections (SET LINE, DIAL, TELNET, SSH, FTP, CONNECT, ...) * Breaking connections (HANGUP, CLOSE) * Transferring files (SEND, GET, RECEIVE, MOVE, RESEND, ...) * Establishing preferences (SET) * Displaying preferences (SHOW) * Managing local files (CD, DELETE, MKDIR, DIRECTORY, RENAME, TYPE, ...) * Managing remote files (RCD, RDEL, RMKDIR, RDIR, ...) * Using local files (FOPEN, FCLOSE, FREAD, FWRITE) * Programming (TAKE, DEFINE, IF, FOR, WHILE, SWITCH, DECLARE, ...) * Interacting with the user (ECHO, ASK, ...) * Interacting with a remote computer (INPUT, OUTPUT, ...) * Interacting with local programs (RUN, EXEC, PTY, ...) * Logging things (LOG SESSION, LOG PACKETS, LOG DEBUG, ...) And of course QUIT or EXIT to get out and HELP to get help, and for programmers: loops, decision making, variables, arrays, associative arrays, integer and floating point arithmetic, macros, built-in and user-defined functions, string manipulation, pattern matching, block structure, scoping, recursion, and all the rest. To get a list of all C-Kermit's commands, type a question mark (?) at the prompt. To get a description of any command, type HELP followed by the name of the command, for example: help send The command interruption character is Ctrl-C (hold down the Ctrl key and press the C key). The command language "escape character", used to introduce variable names, function invocations, and so on, is backslash (\). If you need to include a literal backslash in a command, type two of them, e.g.: get c:\\k95\\k95custom.ini Command Files, Macros, and Scripts A file containing Kermit commands is called a Kermit command file or Kermit script. It can be executed with Kermit's TAKE command: (/current/dir) C-Kermit> take commandfile (where "commandfile" is the name of the command file). Please don't pipe a command file into Kermit's standard input (which might or might not work); if you have Kermit commands in a file, tell Kermit to TAKE the file. In Unix only, a Kermit command file can also be executed directly by including a "kerbang" line as the first line of the file: #!/usr/local/bin/kermit + That is, a top line that starts with "#!", followed immediately by the full path of the Kermit executable, and then, if the Kermit script is to be given arguments on the command line, a space and a plus sign. The script file must also have execute permission: chmod +x commandfile Except for the " +" part, this is exactly the same as you would do for a shell script, a Perl script, etc. Here's a simple but useless example script that regurgitates its arguments (up to three of them): #!/usr/local/bin/kermit + if defined \%1 echo "Argument 1: \%1" if defined \%2 echo "Argument 2: \%2" if defined \%3 echo "Argument 3: \%3" if defined \%4 echo "etc..." exit If this file is stored in your current directory as "commandfile", then: ./commandfile one two three four five prints: Argument 1: one Argument 2: two Argument 3: three etc... This illustrates the basic structure of a standalone Kermit script: the "kerbang line", then some commands. It should end with "exit" unless you want the Kermit prompt to appear when it is finished. \%1 is the first argument, \%2 the second, and so on. You can also create your own commands by defining named macros composed of other Kermit commands (or macros). Here's a simple example: define mydial { set modem type usrobotics set port /dev/ttyS0 if fail end 1 set speed 57600 dial \%1 if success connect } This shows how you can combine many commands into one command, "mydial" in this case (you can use any name you like, provided it does not clash with the name of a built-in command). When this macro definition is in effect, you can type commands like: mydial 7654321 and it executes all the commands in macro definition, substituting the first operand ("7654321") for the formal parameter ("\%1") in the definition. This saves you from having to type lots of commands every time you want to make a modem call. One way to have the macro definition in effect is to type the definition at the Kermit prompt. Another way is to store the definition in a file and TAKE the file. If you want the the definition to be in effect automatically every time you start Kermit, put the definition in your initialization or customization file (explained [67]below). Here's a somewhat more ambitious example: define mydelete { local trash assign trash \v(home)trashcan/ if not defined \%1 end 1 "Delete what?" if wild \%1 end 1 "Deleting multiple files is too scary" if not exist \%1 end 1 "I can't find \%1" if not directory \m(trash) { mkdir \m(trash) if fail end 1 "No trash can" } rename /list \%1 \m(trash) } define myundelete { local trash assign trash \v(home)trashcan/ if not defined \%1 end 1 "Undelete what?" if wild \%1 end 1 "Undeleting multiple files is too hard" if not directory \m(trash) end 1 "No trash can" if not exist \m(trash)\%1 end 1 "I can't find \%1 in trash can" rename /list \m(trash)\%1 . } These macros are not exactly production quality (they don't handle filenames that include path segments, they don't handle multiple files, etc), but you get the idea: you can pass arguments to macros, they can check them and make other kinds of decisions, and the commands themselves are relatively intuitive and intelligible. If you put the above lines into your initialization or customization file, you'll have MYDELETE and MYUNDELETE commands available every time you start Kermit, at least as long as you don't suppress execution of the initialization file. (Exercise for the reader: Make these macros generally useful: remove limitations, add trashcan display, browsing, emptying, etc.) Kerbang scripts execute without the initialization file. This to keep them portable and also to make them start faster. If you want to write Kerbang scripts that depend on the initialization file, include the command take \v(home).kermrc at the desired spot in the script. By the way, \v(xxx) is a built-in variable (xxx is the variable name, "home" in this case). To see what built-in variables are available, type "show variables" at the C-Kermit prompt. To see what else you can show, type "show ?". \m(xxx) is a user defined variable (strictly speaking, it is a macro used as a variable). Command List C-Kermit has more than 200 top-level commands, and some of these, such as SET, branch off into hundreds of subcommands of their own, so it's not practical to describe them all here. Instead, here's a concise list of the most commonly used top-level commands, grouped by category. To learn about each command, type "help" followed by the command name, e.g. "help set". Terms such as Command state and Connect state are explained in subsequent sections. Optional fields are shown in [ italicized brackets ]. filename means the name of a single file. filespec means a file specification that is allowed to contain wildcard characters like '*' to match groups of files. options are (optional) switches like /PAGE, /NOPAGE, /QUIET, etc, listed in the HELP text for each command. Example: send /recursive /larger:10000 /after:-1week /except:*.txt * which can be read as "send all the files in this directory and all the ones underneath it that are larger than 10000 bytes, no more than one week old, and whose names don't end with ".txt". Basic Commands HELP Requests top-level help. HELP command Requests help about the given command.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -