ch13_09.htm

来自「by Randal L. Schwartz and Tom Phoenix I」· HTM 代码 · 共 73 行

HTM
73
字号
<html><head><title>Exercises (Learning Perl, 3rd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Randal L. Schwartz and Tom Phoenix" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly &amp; Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596001320L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Learning Perl, 3rd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img alt="Book Home" border="0" src="gifs/smbanner.gif" usemap="#banner-map" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Learning Perl, 3rd Edition" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch13_08.htm"><img alt="Previous" border="0" src="../gifs/txtpreva.gif" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"></a></td><td align="right" valign="top" width="228"><a href="ch14_01.htm"><img alt="Next" border="0" src="../gifs/txtnexta.gif" /></a></td></tr></table></div><h2 class="sect1">13.9. Exercises</h2><p>The programs here are potentially dangerous! Be careful to test themin a mostly empty directory to make it difficult to accidentallydelete something useful.</p><p>See <a href="appa_12.htm#lperl3-APP-A-SECT-12">Section A.12, "Answers to Chapter 13 Exercises"</a> for answers to the followingexercises.</p><ol><li><p>[6] Write a program that works like <em class="emphasis">rm</em>, deletingany files named on the command line. (You don't need to handleany of the options of <em class="emphasis">rm</em>.)</p></li><li><p>[10] Write a program that works like <em class="emphasis">mv</em>,renaming the first command-line argument to the second command-lineargument. (You don't need to handle any of the options of<em class="emphasis">mv</em> or additional arguments.) Remember to allowfor the destination to be a directory; if it is, use the sameoriginal basename in the new directory.</p></li><li><p>[7] If your operating system supports it, write a program that workslike <em class="emphasis">ln</em>, making a hard link from the firstcommand-line argument to the second. (You don't need to handleoptions of <em class="emphasis">ln</em> or more arguments.) If your systemdoesn't have hard links, just print out a message telling whatoperation you would perform if it were available. Hint: This programhas something in common with the previous one -- recognizing thatcould save you time in coding.</p></li><li><p>[7] If your operating system supports it, fix up the program from theprevious exercise to allow an optional <em class="emphasis">-s</em> switchbefore the other arguments to indicate that you want to make a softlink instead of a hard link. (Even if you don't have hardlinks, see whether you can at least make soft links with thisprogram.)</p></li><li><p>[7] If your operating system supports it, write a program to find anysymbolic links in the current directory and print out their values(like <em class="emphasis">ls -l</em> would: <tt class="literal">name -&gt;value</tt>).<a name="INDEX-951" /></p></li></ol><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch13_08.htm"><img alt="Previous" border="0" src="../gifs/txtpreva.gif" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img alt="Home" border="0" src="../gifs/txthome.gif" /></a></td><td align="right" valign="top" width="228"><a href="ch14_01.htm"><img alt="Next" border="0" src="../gifs/txtnexta.gif" /></a></td></tr><tr><td align="left" valign="top" width="228">13.8. Using Simple Modules</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img alt="Book Index" border="0" src="../gifs/index.gif" /></a></td><td align="right" valign="top" width="228">14. Process Management</td></tr></table></div><hr width="684" align="left" /><img alt="Library Navigation Links" border="0" src="../gifs/navbar.gif" usemap="#library-map" /><p><p><font size="-1"><a href="copyrght.htm">Copyright &copy; 2002</a> O'Reilly &amp; Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>

⌨️ 快捷键说明

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