欢迎来到天天文库
浏览记录
ID:479870
大小:248.62 KB
页数:27页
时间:2017-08-09
《【计算机科学与技术专业】【毕业设计】Linux Shell的设计与实现》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、( 20 届)本科毕业论文LinuxShell的设计与实现II摘要:shell是用户和Linux操作系统之间的接口。shell是一个命令语言解释器。无论何时用户输入一个命令都将由Linuxshell解释。当用户登录一个Unix系统时,用户可以访问事件日志文件来了解什么是shell及其工作原理。用户通常通过Unix机器上的终端端口(无论是一个老式的串行终端或例如xterm的终端仿真程序)来访问该机器的Unix系统。本文在UBUNTU下编写的shell程序具有如下几个功能:1.程序执行:用户在终端所有请求执行的程序都由shell负责。用户每次输入一行命令后
2、,shell分析它并决定如何执行。每一行命令都要遵循shell规定的基本格式:程序名参数2.变量和文件名替换:像其他任何的编程语言一样,shell允许我们指定变量的值。在$符号前定义了变量的值,shell则在命令行中用指定的值替换变量。3.标准输入/输出和I/O重定向:标准输入/输出和重定向是shell在命令行中的主要责任。当发生特别事件时它扫描命令行中的重定向字符<或>或>>。4.管道:正如shell扫描命令行中的重定向字符,它也扫描管道字符
3、。对于每一次找到这样的字符,它连接程序标准输出前面的
4、和程序标准输入后面的“
5、”。关键词:Linux;She
6、ll;标准输入输出;I/O重定向;管道IIDesignandImplementationofLinuxShellAbstract:TheshellisaprogramusedtointerfacebetweentheuserandtheLinuxkernel.Theshellisacommandlineinterpreter.WheneverweenteracommanditisinterpretedbytheLinuxshell.Tounderstandwhattheshellis,andwhatitactuallydoes,wereviewthes
7、equenceofeventsthathappenwhenwelogintoaUnixsystem.WenormallyaccessaUnixsystemthroughaterminal(beitanoldfashionedserialterminal,oraterminalemulatorsuchasaxtermwindow)connectedtocertainportsontheUnixmachine.Theshellhasseveralresponsibilitiesnamely:1.ProgramexecutionTheshellisrespo
8、nsiblefortheexecutionofallprogramsthatwerequestfromourterminal.Eachtimewetypeinalinetotheshell,theshellanalysesthelineandthendetermineswhattodo.Asfarastheshellisconcerned,eachlinefollowsthesamebasicformat:program-namearguments2.VariableandFilenamesubstitutionLikeanyotherprogramm
9、inglanguage,theshellallowsustoassignvaluestovariables.Wheneverwespecifyoneofthesevariablesonthecommandline,precededbyandollarsign,theshellsubstituesthevaluethatwasassignedtothevariableatthatpoint3.StandardInput/OutputandI/OredirectionItistheshells’responsibilitytotakecareofinput
10、andoutputredirectiononthecommandline.Itscansthecommandlinefortheoccurrenceofthespecialredirectioncharacters<,>or>>.4.PipesJustastheshellscansthecommandlineforredirectioncharacters,italsoscansforthepipecharacter
11、.Foreachsuchcharacteritfinds,itconnectsthestandardoutputfromtheprogr
12、amprecedingthe
13、tothestandardinputoftheprogramfo
此文档下载收益归作者所有