📄 readme.os2
字号:
OS/2 port of pdksh version 5 June, 1996IntroductionThis document is intended to define the specific features anddifferences in the os/2 port of pdksh. For general features anddescriptions of pdksh itself please refer to the standard pdksh READMEor the man page. In general the port has tried to maintain as many ofthe standard ksh features as possible. For installation details andan introduction to ksh please read the README.1st file shipped in therun time zip package for os2.A default build of pdksh, called ksh.exe, is included in the os2run time package. This version was built using the emx environment andtherefore requires that an emx run time package 0.9b or later beinstalled on the system. This is not normally a problem since youprobably already installed it for 'ls' and other Unix commands fromthe file gnufutil.zip. (If you haven't install gnufutil.zip you maywant to consider it.)Building KSH.EXEIf you would rather build your own, you should obtain the sources fromftp.cs.mun.ca in the directory pub/pdksh. You will need a copy of tarand gunzip to unload the archive and install on an hpfs partition. Changeto the source directory and run the script os2\configure.cmd. (If youprefer you can copy configure.cmd to the source directory.) This willprepare the build environment so that your version of make can be usedto build the executable. Note that configure.cmd is still underconstruction and you may need to make changes to the Makefile and toconfig.h to match your specific needs. Copies of all of these fileswill be placed into the source directory. In addition you may want tomake changes to config.h to define your particular preferences.Configure.cmd for os2 support these optional options and arguments: /h | /? | -h Print a usage message and exit. /v | -v Print verbose output during configure /d | -d build a debug version with symbols (for gcc) sh build sh rather than ksh Any configuration other that the default requires that sed be in yoursearch path. You should always get a copy of the latest pre-built versionof ksh as well since the file os2bugs may contain some last minute fixesthat were too late to include in the formal release, and you may find someother updates. In addition the run time version supplies a couple ofsample icons for use with ksh.At this point you can use your favorite make command to build theexecutable. Pdksh is known to work with nmake and dmake, gnu make requiresat least version 3.7.3 and is the only one that will automatically make theman page. You can manually run mkman after starting your new copy of ksh,'ksh mkman ksh|sh ksh.man'. (A prebuilt sh and expanded cat version ofksh.1 is included in the rt package.)There is a built in check routine that is part of the makefile. Type'make check' to run it. This routine needs a copy of perl on yourmachine in order to support the test harness used to test the build. Ihave built the infrastructure into the port to support this checking buthave not been able to get it all to run correctly yet. The problem isbecause of a bug in the os2 port of ksh. To check the build without usingperl, run the command: 'ksh Bugs ksh'. This will use the older checkingfacility. You should run this if you make any changes to the source toinsure that you haven't broken something crucial. Run make check on anunmodified version first so that you will know what to expect. If youwant to get the perl version running please contact me for information.KSH 5 VERSUS KSH 4.9The KSH version 5 effort is being spearheaded by Michael Rendell. Michaeltook over the effort from Simon J. Gerraty who maintained the version 4code. While the version 4 code was a good implementation of kshversion 5 strives to continue the conformance to the actual posixdefinitions and to AT&T ksh.For my version 5 port to os/2, I originally started with the 4.9 os/2changes and applied them to the new version. Subsequently many changeshave been made so that there is little resemblance to that version.One of my goals for version 5 is to make ksh not only and interactive shell, but one that can run some limited Unix(tm) shell scripts as well.Generally the two shells behave the same. Version 5 has no logout script(This can be set up using a trap in your profile.ksh file if desired.) andthe option 'hashall' has been replaced with 'trackall'. (To see all of theoptions use the command 'set -o'.) In addition the prompt has been changedto conform with the at&t ksh shell instead of the csh like implemetation ofversion 4. The '!' sign is used for the history number and $variablesubstitutions can be used in the prompt. The commands generally behave moreconsistently. For example bind now goes to standard out so it can beredirected or piped. Arrays are now implemented as are almost all AT&T kshfeatures plus a few more. The os/2 port provides file name completion thatis not case sensitive. The startup file kshrc.ksh is still supported, butthe way it works is slightly different.OS2 IMPLEMENTATION VS. UNIXThe original OS/2 port was done by Kai Uwe Rommel. I have re-implementedhis ideas in this os/2 version. The os/2 version of ksh has been modifiedto accept the standard os/2 conventions. Drive designations a:, etc., areaccepted and path separators in variables have been changed to ';'. Inaddition either '/' or '\' can be used as a directory separator. The bindcommand in emacs mode has been enhanced to accept function key and alt keybindings. (To see what the alt key binding should be, use ^Q followed bythe key you are interested in. Replace the ^ alpha you see with ^0, typedas two characters, in the bind command.) The cursor keys have beenimplemented for command history for both emacs mode and vi insert mode.Standard default stty settings are implemented for both modes as well.A os2 only print option, -f, can be used to force forward slashes in itsargument. This can be used to switch a variable containing '\' tooutput '/' in a pipe to a unix command that doesn't like '\' as a pathseparator, such as sed./ vs. \ processingThe remapping of certain keys can lead to some confusion for Unix and OS/2users. The '\' key has a different meaning in Unix where it is usedto escape a special meaning for the character following it or in thecase of the echo (typeset) command it provides special meanings tocertain characters. At the end of a line the '\' is used to escape theline feed permitting a command to extend to multiple lines. In OS/2this key is generally the directory name separator. To provide forboth functions in the OS/2 pdksh the '\' is defined to be a directoryseparator in any pathname specification and will keep its escapemeaning when it is followed by any non-alphanumeric character. Theecho command retains its special interpretation of '\' and will, forexample, interpret \t as a tab when printing. This can bedisconcerting when you echo the variable that you just set to c:\tmp.If you want to use echo on a variable with pathnames in it you shouldeither use uppercase names or a '/' as a separator. Another choice isto alias echo to 'print -r' or perhaps 'echo -E'. This will disable the special interpretaions. You could even use the new 'print -f' to force any '\' to switch to '/', but this is less portable. If you have loaded the printenv command it can be used to look at variables.Unix uses '/' as a directory separator and the OS/2 implementationpermits and in some cases prefers this use as well. Generally youcan freely mix '/' and '\' characters in a pathname. However, 'cd \'will not complete since '\' will escape the new line command and youwill get the secondary prompt. Just enter a / and the command willcomplete. For many standard os/2 commands the '/' is used to indicate anoption and may want a '\' as a path separator. These will still work andbe correctly interpreted with pdksh as long as a '/' is not attached directly to the command name. Just be sure and enter the syntax neededby the command you are trying to execute.While backslash processing is usually correct and automatic there are timeswhen it doesn't do what you might expect. For example ls \tmp\*.exe mightsurprise you. In this case the '\' will be interpreted as an escape forthe '*' character. You may need quotes or several backslashes to get whatyou want. Beginning with 5.2.4 the output of ksh favors '/' for anygenerated pathnames. This is intended to make script processing forunix scripts easier. Unfortunately, this may make interactive use foros2 users that prefer the '\' key a little less desirable. Should youprefer the earlier convention then you can rebuild the executable fromthe sources. Only one change in sh.h, DIRSEP, controls this behavior.; vs. : processingAnother conflict is the use of ':' and ';'. Unix uses ':' to separateentries in variable assignment and ';' to indicate multiple commandson the same line. OS/2 uses the ';' to separate entries in a variable.This could lead to problems when making an assignment to a variable inpdksh. You will need to escape the ';' in OS/2 to prevent the shellfrom interpreting it as the end of the command. Either surround theassignment command with quotes or use '\;'. Note that since a ';' isnot a valid filename or pathname character the '\' will be correctlyinterpreted as an escape character.Since having to escape the ';' character can be a pain when changingenvironmental variables containing a list of paths there are some functionsdefined in the sample kshrc.ksh file to ease this task. There are threefunctions; add_path, pre_path, and del_path that can be used to append apath, prepend a path or delete a path from any environmental variable (PATHby default). If you needed to add a path to /emx/bin you might do "add_pathe:\emx\bin" for example, or perhaps "add_path e:\emx\book BOOKSHELF" to addsome books to the bookshelf. Note that you will need a copy of sed in yoursearch path to use the del_path function.In OS/2 the ':' is used to separate the drive letter from the rest ofthe pathname. This usage had been preserved in pdksh. You can imbedthe drive letter as needed in pathnames. In addition pdksh preservesthe notion of separate contexts for each drive. To change drives youwould use the cd command. "cd A:/" would change to the root on driveA while "cd C:." would change to whatever was current context on driveC. Some aliases are defined in the sample kshrc.ksh to permit theusual A: to automatically do a change directory to the A drive. Wildcard ProcessingOS/2 and pdksh have similar notions about wildcard characters '*' and'?' except that pdksh handles the expansion of these wildcard withinthe shell and then passes the answer as a list to the application. Ifthe application needs to see the wildcard character then you mustescape it from the shell. Note that pdksh knows about other wildcardtechniques as well. Please see the man page.Background ProcessingDo to some limitations in the os2 fork process and other differencesbetween os2 and unix it is not possible to support back-grounding frompdksh of commands that begin a new window. For this reason I haveautomatically backgrounded all such tasks when they are started. Thiswill permit the os2 ksh to serve as a command line launch mechanism fordos, full screen, and pm applications. (Note that currently ksh can onlylaunch an application of the same type (windowed, or fullscreen) thatksh itself is unless you use the 'start' alias.There is a 'start' alias defined in the sample kshrc.ksh file that canbe used to start normal command line commands in a new window. For exampleyou could say "start ksh" to start a copy of ksh itself in a new window.Since it is a new window it will automatically return control to the existingcopy of ksh. Note that the start alias uses the os2 start command soyou could supply it with any standard start option such as /FS to forcea full screen copy. Please check your os2 command reference manual forfurther information on start.PDKSH, OS/2 and the ENVIRONMENT.The environment in OS/2 and Unix are quite different. For one thingyou don't actually login to your machine in OS/2 and your initialenvironment is established by your CONFIG.SYS file. The Shell will usethe variables that were set in CONFIG.SYS and you should reallyconsider assigning TMPDIR and HOME for use by pdksh. It will also useENV as a variable that names a startup file that will run each timethe shell is started, even if a script is started. This start up fileis located in your home directory. For compatability with 4.9 thisshell will also automatically use a startup shell kshrc.ksh if itfinds one in your home directory, is started interactively, and $ENVis not set. The variable OS2_SHELL should point to cmd.exe or a fully compatibleversion and will be used as the shell of choice for any scripts that youwrite that do not contain the #! or extproc information in the top lineof the script. If you prefer you can set the variable EXECSHELL to ashell to be used instead of OS2_SHELL. The use of OS2_SHELL assumes thatthe shell requires the /c option and that the shell needs all pathnamesseparated with '\'. Setting EXECSHELL will disable both of theseassumptions.A special feature is the support of the -l, login option. If this option isentered when starting ksh then the shell will execute a loginfile calledprofile.ksh if located in $INIT/etc, c:/usr/etc, or your home. If you areusing this shell as your primary shell you may wish to change the settingsin your os2 command shell notebook to call ksh.exe -l. I would notrecommend changing the default shell in config.sys.Should you destroy your PATH variable try 'unset PATH'. A defaultpath may get you going again. In addition pdksh for OS/2 always usescommands from current context first in the search path even if it isnot explicitly set. By default c: drive is used when no variablesare set. Specifically c:/usr/bin and c:/usr/etc can be used as defaultsvarious places in ksh. If you build your own version then this can be
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -