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

📄 ch01_07.htm

📁 the unix power tools
💻 HTM
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 1] 1.7 Power Grows on You </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly &amp; Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly &amp; Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:31:04Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch01_01.htm"TITLE="1. Introduction"><LINKREL="prev"HREF="ch01_06.htm"TITLE="1.6 Power Tools for Editing "><LINKREL="next"HREF="ch01_08.htm"TITLE="1.8 There Are Many Shells "></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_06.htm"TITLE="1.6 Power Tools for Editing "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.6 Power Tools for Editing "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 1<BR>Introduction</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_08.htm"TITLE="1.8 There Are Many Shells "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.8 There Are Many Shells "BORDER="0"></A></TD></TR></TABLE>&nbsp;<HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-1004">1.7 Power Grows on You </A></H2><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-1023"></A>It has been said that UNIX is not an operatingsystem as much as it is a way of thinking. In<EMCLASS="emphasis">The UNIX Programming Environment</EM>,Kernighan and Pike write that at the heart of theUNIX philosophy &quot;is the idea that the power of asystem comes more from the relationships amongprograms than from the programs themselves.&quot;</P><PCLASS="para">Almost all of the utility programs that rununder UNIX share the same user interface&nbsp;- aminimal interface to be sure&nbsp;- but one that allowsthem to be strung together in pipelines to do jobsthat no single program could do alone.</P><PCLASS="para">There are many operating systems with features UNIX can't match&nbsp;- betterperformance, better documentation, more ease of use.But none of them are so powerful or so exciting to use onceyou get the hang of pipes and filters, and the programming power of the shell.</P><PCLASS="para">A new user starts by stringing together simple pipelines and, when they getlong enough,<SPANCLASS="link">saving them into a file (<ACLASS="linkend"HREF="ch01_05.htm"TITLE="Anyone Can Program the Shell ">1.5</A>)</SPAN>for later execution.Gradually, if the user has the right temperament, he gets the idea thatthe computer can do more of the boring part ofmany jobs.Perhaps he starts out with a<SPANCLASS="link"><EMCLASS="emphasis">for</EM> loop (<ACLASS="linkend"HREF="ch09_12.htm"TITLE="The Bourne Shell for Loop ">9.12</A>)</SPAN>toapply the same editing script to a series of files.Conditions and cases soon follow and before long,he finds himself programming.</P><PCLASS="para">On most systems, you need to learn consciously how to program.You must take up the study of one or more programming languages andspend a fair amount of concentrated effort beforeyou can do anything productive.UNIX, on the other hand, teaches programming imperceptibly&nbsp;- it is a slow butsteady extension of the work you do simply in interacting with the computer.</P><PCLASS="para">Before long, you can step outside the boundsof the tools that have already been provided by thedesigners of the system, and solve problems thatdon't quite fit the mold. This is sometimes called<ACLASS="indexterm"NAME="AUTOID-1035"></A>hacking; in other contexts, it is called &quot;engineering.&quot;In essence, it is the ability to build a tool whenthe right one is not already on hand.</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-1038"></A>Dale Dougherty compares UNIX tothe Volkswagen beetle, that unique automobile ofthe '60s and '70s.Its simple design was in part whatmade it popular; the &quot;bug&quot; was hand-maintainable.VW owners (users) could tinker with their cars,performing such tasks as changing spark plugs byhand.They scoffed at owners of other cars whodepended upon auto mechanics.It is perhaps thissame feeling of independence (let me do it myself) that the UNIXenvironment fosters in its users.There are many other, quite capable softwareenvironments that are packaged to keep users out,like a television set.</P><PCLASS="para">In some ways, the secret of UNIX is that itsworking parts are visible.The UNIX environment,like the VW beetle, is designed so that users cantake it apart and put it back together.UNIX provides general-purpose tools, all of which aredesigned to work together.</P><PCLASS="para">No single program, however well thought out,will solve every problem.There is always a specialcase, a special need, a situation that runs counter tothe expected.But UNIX is not a single program. Itis a collection of hundreds of them, and with these basictools, a clever or dedicated person canmeet just about any computing problem.</P><PCLASS="para">Like the fruits of any advanced system, thesecapabilities don't fall unbidden into the hands ofnew users.But they are there for the reaching. Andover time, even those users who want a system theydon't have to think about will gradually reach outfor these capabilities.Faced with a choice betweenan hour spent on a boring, repetitive task and anhour putting together a tool that will do the task ina flash, most of us will choose the latter.</P><DIVCLASS="sect1info"><PCLASS="SECT1INFO">- <SPANCLASS="authorinitials">TOR</SPAN></P></DIV></DIV><DIVCLASS="htmlnav"><P></P><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_06.htm"TITLE="1.6 Power Tools for Editing "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 1.6 Power Tools for Editing "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="book"HREF="index.htm"TITLE="UNIX Power Tools"><IMGSRC="gifs/txthome.gif"SRC="gifs/txthome.gif"ALT="UNIX Power Tools"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch01_08.htm"TITLE="1.8 There Are Many Shells "><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 1.8 There Are Many Shells "BORDER="0"></A></TD></TR><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172">1.6 Power Tools for Editing </TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><ACLASS="index"HREF="index/idx_0.htm"TITLE="Book Index"><IMGSRC="gifs/index.gif"SRC="gifs/index.gif"ALT="Book Index"BORDER="0"></A></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172">1.8 There Are Many Shells </TD></TR></TABLE><HRALIGN="LEFT"WIDTH="515"TITLE="footer"><IMGSRC="gifs/smnavbar.gif"SRC="gifs/smnavbar.gif"USEMAP="#map"BORDER="0"ALT="The UNIX CD Bookshelf Navigation"><MAPNAME="map"><AREASHAPE="RECT"COORDS="0,0,73,21"HREF="../index.htm"ALT="The UNIX CD Bookshelf"><AREASHAPE="RECT"COORDS="74,0,163,21"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="164,0,257,21"HREF="../unixnut/index.htm"ALT="UNIX in a Nutshell"><AREASHAPE="RECT"COORDS="258,0,321,21"HREF="../vi/index.htm"ALT="Learning the vi Editor"><AREASHAPE="RECT"COORDS="322,0,378,21"HREF="../sedawk/index.htm"ALT="sed &amp; awk"><AREASHAPE="RECT"COORDS="379,0,438,21"HREF="../ksh/index.htm"ALT="Learning the Korn Shell"><AREASHAPE="RECT"COORDS="439,0,514,21"HREF="../lrnunix/index.htm"ALT="Learning the UNIX Operating System"></MAP></DIV></BODY></HTML>

⌨️ 快捷键说明

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