会员注册 | 登录 | 微信快捷登录 支付宝快捷登录 QQ登录 微博登录 | 帮助中心 人人文库renrendoc.com美如初恋!
站内搜索 百度文库

热门搜索: 直缝焊接机 矿井提升机 循环球式转向器图纸 机器人手爪发展史 管道机器人dwg 动平衡试验台设计

   首页 人人文库网 > 资源分类 > DOC文档下载

外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc

  • 资源星级:
  • 资源大小:32.50KB   全文页数:6页
  • 资源格式: DOC        下载权限:注册会员/VIP会员
您还没有登陆,请先登录。登陆后即可下载此文档。
  合作网站登录: 微信快捷登录 支付宝快捷登录   QQ登录   微博登录
友情提示
2:本站资源不支持迅雷下载,请使用浏览器直接下载(不支持QQ浏览器)
3:本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰   

外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc

附录外文资料翻译原文部分AdvancedBashScriptingGuideAnindepthexplorationoftheartofshellscripting1.IntroductionTheshellisacommandinterpreter.Morethanjusttheinsulatinglayerbetweentheoperatingsystemkernelandtheuser,itsalsoafairlypowerfulprogramminglanguage.Ashellprogram,calledascript,isaneasytousetoolforbuildingapplicationsbygluingtogethersystemcalls,tools,utilities,andcompiledbinaries.VirtuallytheentirerepertoireofUNIXcommands,utilities,andtoolsisavailableforinvocationbyashellscript.Ifthatwerenotenough,internalshellcommands,suchastestingandloopconstructs,giveadditionalpowerandflexibilitytoscripts.Shellscriptslendthemselvesexceptionallywelltoadministrativesystemtasksandotherroutinerepetitivejobsnotrequiringthebellsandwhistlesofafullblowntightlystructuredprogramminglanguage.2.WhyShellProgrammingAworkingknowledgeofshellscriptingisessentialtoanyonewishingtobecomereasonablyproficientatsystemadministration,eveniftheydonotanticipateeverhavingtoactuallywriteascript.ConsiderthatasaLinuxmachinebootsup,itexecutestheshellscriptsin/etc/rc.dtorestorethesystemconfigurationandsetupservices.Adetailedunderstandingofthesestartupscriptsisimportantforanalyzingthebehaviorofasystem,andpossiblymodifyingit.Writingshellscriptsisnothardtolearn,sincethescriptscanbebuiltinbitesizedsectionsandthereisonlyafairlysmallsetofshellspecificoperatorsandoptionstolearn.Thesyntaxissimpleandstraightforward,similartothatofinvokingandchainingtogetherutilitiesatthecommandline,andthereareonlyafewrulestolearn.Mostshortscriptsworkrightthefirsttime,anddebuggingeventhelongeronesisstraightforward.Ashellscriptisaquickanddirtymethodofprototypingacomplexapplication.Gettingevenalimitedsubsetofthefunctionalitytoworkinashellscriptisoftenausefulfirststageinprojectdevelopment.Thisway,thestructureoftheapplicationcanbetestedandplayedwith,andthemajorpitfallsfoundbeforeproceedingtothefinalcodinginC,C,Java,orPerl.ShellscriptinghearkensbacktotheclassicUNIXphilosophyofbreakingcomplexprojectsintosimplersubtasks,ofchainingtogethercomponentsandutilities.Manyconsiderthisabetter,oratleastmoreestheticallypleasingapproachtoproblemsolvingthanusingoneofthenewgenerationofhighpoweredallinonelanguages,suchasPerl,whichattempttobeallthingstoallpeople,butatthecostofforcingyoutoalteryourthinkingprocessestofitthetool.WhennottouseshellscriptsResourceintensivetasks,especiallywherespeedisafactorsorting,hashing,etc.Proceduresinvolvingheavydutymathoperations,especiallyfloatingpointarithmetic,arbitraryprecisioncalculations,orcomplexnumbersuseCorFORTRANinsteadCrossplatformportabilityrequireduseCorJavainsteadComplexapplications,wherestructuredprogrammingisanecessityneedtypecheckingofvariables,functionprototypes,etc.Missioncriticalapplicationsuponwhichyouarebettingtheranch,orthefutureofthecompanySituationswheresecurityisimportant,whereyouneedtoguaranteetheintegrityofyoursystemandprotectagainstintrusion,cracking,andvandalismProjectconsistsofsubcomponentswithinterlockingdependenciesExtensivefileoperationsrequiredBashislimitedtoserialfileaccess,andthatonlyinaparticularlyclumsyandinefficientlinebylinefashionNeednativesupportformultidimensionalarraysNeeddatastructures,suchaslinkedlistsortreesNeedtogenerateormanipulategraphicsorGUIsNeeddirectaccesstosystemhardwareNeedportorsocketI/ONeedtouselibrariesorinterfacewithlegacycodeProprietary,closedsourceapplicationsshellscriptsputthesourcecoderightoutintheopenforalltheworldtoseeIfanyoftheaboveapplies,consideramorepowerfulscriptinglanguageperhapsPerl,Tcl,Python,RubyorpossiblyahighlevelcompiledlanguagesuchasC,C,orJava.Eventhen,prototypingtheapplicationasashellscriptmightstillbeausefuldevelopmentstep.WewillbeusingBash,anacronymforBourneAgainshellandapunonStephenBournesnowclassicBourneshell.BashhasbecomeadefactostandardforshellscriptingonallflavorsofUNIX.Mostoftheprinciplesthisbookcoversapplyequallywelltoscriptingwithothershells,suchastheKornShell,fromwhichBashderivessomeofitsfeatures,andtheCShellanditsvariants.NotethatCShellprogrammingisnotrecommendedduetocertaininherentproblems,aspointedoutinanOctober,1993UsenetpostbyTomChristiansen.Whatfollowsisatutorialonshellscripting.Itreliesheavilyonexamplestoillustratevariousfeaturesoftheshell.Theexamplescriptsworktheyvebeentested,insofaraswaspossibleandsomeofthemareevenusefulinreallife.Thereadercanplaywiththeactualworkingcodeoftheexamplesinthesourcearchivescriptname.shorscriptname.bash,givethemexecutepermissionchmodurxscriptname,thenrunthemtoseewhathappens.Shouldthesourcearchivenotbeavailable,thencutandpastefromtheHTML,pdf,ortextrenderedversions.Beawarethatsomeofthescriptspresentedhereintroducefeaturesbeforetheyareexplained,andthismayrequirethereadertotemporarilyskipaheadforenlightenment.外文资料翻译译文部分高级Bash脚本编程指南一个对脚本编程技术的深入讨论1简介Shell是一个命令解释器。它是操作系统内核和用户之间的绝缘层,也是一种功能强大的编程语言。一个Shell程序,通常被称作为脚本,它是由系统调用,命令工具,软件包和已编译的二进制包结合起来的容易使用的工具。事实上,shell脚本可以调用整个UNIX系统命令,软件包和工具。如果这还不太够的话,Shell的内部命令,如测试和循环结构,都使得Shell脚本更强大和更有弹性。Shell脚本在管理系统任务中表现得非常出色,在对日常反复性的处理工作中避免使用那些结构复杂的程序语言。2为什么要用Shell编程脚本应用知识对希望精通系统管理的任何个人说是必需的,他实际上不想写一个脚本程序。一般说一个Linux机器启动后,它会执行在/etc/rc.d目录下的Shell脚本重建系统环境并且启动各种服务。理解这些启动脚本的细节对分析系统运作并修改它是有很大意义的。编写shell脚本并不难学,因为脚本内建的功能集(check)和他们只要学相当少的shell的操作符和选项。语法简单易懂,像在命令行上调用和连接软件包那样容易,它只有少量的规则需要掌握。大多数短小的脚本第一次就工作的很好,较长的脚本调试也相当的容易。shell脚本是个复杂应用原型的quickanddirty方法。在项目开发中用shell编程实现个有限的功能性子集是有用的开始。用这种方法去测试应用程序的结构和模块组合,可以在实际地用C,C,Java或者Perl进行编程之前发现主要的设计缺陷。Shell编程遵从经典UNIX哲学把复杂的问题分成简单的小问题,然后再把各部分功能组合起来解决复杂问题。这和用新一代高级的多用途的语言,例如Perl,试图成为所有人处理所有事情的语言但是所付出的代价是强迫改变你的思维方法来适应这种工具,大多数人认为这是一个更好的或者至少感觉上更令人能

注意事项

本文(外文翻译--高级Bash脚本编程指南一个对脚本编程技术的深入讨论.doc)为本站会员(淘宝运营)主动上传,人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知人人文库网([email protected]),我们立即给予删除!

温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。

copyright@ 2015-2017 人人文库网网站版权所有
苏ICP备12009002号-5