⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 225-228.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:pdksh</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=12//-->

<!--PAGES=225-228//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch11/220-224.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="228-231.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H2><A NAME="Heading1"></A><FONT COLOR="#000077">Chapter 12<BR>pdksh

</FONT></H2>

<P><I>by Rick McMullin and Tim Parker</I></P>

<DL>

<DT><B>In This Chapter</B>

<DT>&#149;&nbsp;&nbsp; The public domain korn shell (pdksh)

<DT>&#149;&nbsp;&nbsp; Shell prompts

<DT>&#149;&nbsp;&nbsp; Job control

<DT>&#149;&nbsp;&nbsp; Key bindings

<DT>&#149;&nbsp;&nbsp; Customizing your pdksh

<DT>&#149;&nbsp;&nbsp; pdksh commands

<DT>&#149;&nbsp;&nbsp; pdksh variables

</DL>

<P>In the last chapter, you saw the Bourne Again Shell (<TT>bash</TT>) in some detail. Not everyone wants to use the bash shell, so several other shells are included with most Linux systems. One of them is pdksh, a variation on the Korn shell. We&#146;ll also look at how you can customize your copy of <TT>pdksh</TT>, as well as several of the important commands and variables used by the shell.</P>

<H3><A NAME="Heading2"></A><FONT COLOR="#000077">The Public Domain Korn Shell (pdksh)</FONT></H3>

<P>The Korn shell, written by David Korn, was the third mainstream shell written for UNIX (after the Bourne shell and the C shell). Because of this, it incorporates many of the features of the Bourne and C shells together. The Korn shell is not usually distributed with all UNIX versions, so many users don&#146;t get to work with it. The Korn shell is important to UNIX users, though, because it builds a lot of the important new features of the C shell into the much older Bourne shell, while remaining completely compatible with <TT>sh</TT>. Because of the Korn shell&#146;s popularity among UNIX users, a version was developed for Linux called the Public Domain Korn Shell, or <TT>pdksh</TT>.</P>

<P>The current version of the Public Domain Korn Shell does not support all of the features that exist in the commercial version of the Korn shell. It does support most of the main features, however, and adds a few new features of its own.</P>

<H4 ALIGN="LEFT"><A NAME="Heading3"></A><FONT COLOR="#000077">Command-Line Completion</FONT></H4>

<P>Often, when you are entering commands at the command line, the complete text of the command is not necessary in order for <TT>pdksh</TT> to be able to determine what you want to do. Command-line completion enables you to type in a partial command, and then by entering a key sequence, tell <TT>pdksh</TT> to try to finish the command for you.</P>

<TT>pdksh</TT> does not default to allow the user to perform command-line completion. You must enter a command to tell <TT>pdksh</TT> that you want to be able to use command-line completion. In order to enable command-line completion, enter one of the following commands:

<!-- CODE SNIP //-->

<PRE>

set -o emacs

set -o vi

</PRE>

<!-- END CODE SNIP //-->

<P>This causes <TT>pdksh</TT> to accept command editing that is similar to <TT>emacs</TT> or <TT>vi</TT>. Choose the editor that you are most familiar with, and use the basic editor commands for command-line editing.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>Most people find the <TT>emacs</TT> editing mode more user-friendly than the <TT>vi</TT> editing mode.

<P>When using <TT>vi</TT> command-line editing, you must be in command mode when you enter any of the editing commands. You can enter command mode by pressing the Esc key. When command mode has been entered, you cannot type any characters onto the command line until you enter edit mode. There are many ways of doing this, but the usual way is by pressing the i (insert) key.<HR></FONT>

</BLOCKQUOTE>

</P>

<P>After the command-line completion function is enabled, you can perform command-line completion by pressing the Esc key twice (when using <TT>emacs</TT> command-line editing) or by pressing \ (when using <TT>vi</TT> command-line editing). For example, if your current directory contains the files</P>

<!-- CODE SNIP //-->

<PRE>

News/    bin/    games/   mail/    sample.text    test/

</PRE>

<!-- END CODE SNIP //-->

<P>and you want to edit the file <TT>sample.text</TT> using the <TT>vi</TT> text editor, enter the following command:</P>

<!-- CODE SNIP //-->

<PRE>

vi sample.text

</PRE>

<!-- END CODE SNIP //-->

<P>After the &#147;s&#148; is typed, the only file that you can be referring to is <TT>sample.text</TT> because it is the only file in the current directory that begins with the letter &#147;s&#148;. To get <TT>pdksh</TT> to finish the command when you are using <TT>emacs</TT>-style command editing, press the Esc key twice after typing <B>s</B>:</P>

<!-- CODE SNIP //-->

<PRE>

vi s&lt;escape&gt;&lt;escape&gt;

</PRE>

<!-- END CODE SNIP //-->

<P>To get <TT>pdksh</TT> to finish the command when you are using <TT>vi</TT> command editing, press the \ key after typing <B>s</B>:</P>

<!-- CODE SNIP //-->

<PRE>

vi s\

</PRE>

<!-- END CODE SNIP //-->

<P>Either of these commands causes <TT>pdksh</TT> to finish the line for you and displays the result on the screen. The command does not execute until you press the Enter key. This is to give you a chance to confirm that the command <TT>pdksh</TT> displays is the command that you really intend.</P>

<P>If the <TT>sample.text</TT> file is not the only file in the directory that begins with the letter &#147;s&#148;, <TT>pdksh</TT> completes the command as far as it can and then beeps, indicating that it needs more information to complete the command.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>The keyboard equivalent of pressing the Esc key is Ctrl&#43;[, usually written as <TT>^[</TT>. The caret (<TT>^</TT>) is the abbreviation for the Ctrl key. Pressing Esc twice using the Ctrl&#43;[ sequence would be written as <TT>^[^[</TT>. You may see this convention in books or man pages.<HR></FONT>

</BLOCKQUOTE>

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch11/220-224.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="228-231.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





</td>
</tr>
</table>

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -