ImageVerifierCode 换一换
格式:DOC , 页数:26 ,大小:2.55MB ,
资源ID:4575401      下载积分:5 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/4575401.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(Linux unixShellsprograming学习笔记.doc)为本站上传会员【二***】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

Linux unixShellsprograming学习笔记.doc

1、Linux&unix Shells programing学习笔记 一、 introduction to unix/linux shells 1、 what is unix ? what is Linux a Little History 2、 3、 Definition and function of a shell The kernel、The shell、and User 4、 Unix shell Boume shell 、c shell、 kom shell 5、 Linux shell Bash 6、 Cat /etc/shells(列出系统中所

2、包含的shell) 7、 Echo $SHELL(列出目前正在使用的shell) 8、 Cat /etc/passwd(查看用户所对应的shell) 9、 What is posix? Portable operating system interface of unix 10、 History of the shell 11、 Uses of the shell A、 when running interactivery, one of the major functions of a shell is interpret commands entered at the c

3、ommand-line prompt.(交互式下解释命令行输入的命令) B、 Another important function of the shell is customize the user’s environment, normally done in shell initialization files.(定制用户的环境) C、 The shell can also be used as an interpreted programming language.(作为解释性的变成语言) 12、 Responsibilities of the shell The shell

4、is ultimately responsible for making sure that any commands typed at the prompt get executed properly. Included in those responsibilities are: A、 reading input and parsing the command line(读取输入并解析命令行) B、 evaluation special characters, such as wildcards and the history character(替换特殊字符) C、 setting

5、 up pipes, redirection, and background processing(设置管道、重定向和后台处理) D、 handing signals(处理信号) E、 setting up programs for execution(程序执行的相关设计) 13、 System Startup and the login shell A、 parsing the command line when you type a command at the prompt, the shell read a line of input and parses the comma

6、nd line, breaking the line into words, called tokens. Tokens are separated by spaces and tabs and the command line is terminated by a newline. The shell then checks to see whether the first word is a built-in command or an executable. l History substitution is performed (if applicable).(执行命令替换) l

7、Command line is broken up into tokens, or words.(命令行分解为tokens) l History is update (if applicable).(命令更新) l Quotes are processed.(引入的处理) l Alias substitution and functions are defined (if applicable)(别名替换,和函数的定义) l Redirection , background, and pipes are set up.(设置重定向、后台管理和管道) l Variable substi

8、tution( $user, $name, etc.) is performed.(执行变量的替换) l Command substitution (echo “Today is ‘data’ ”) is performed.(执行命令替换) l Filename substitution, called globbing (cat abc.??, rm *.c, etc.) is performed.(执行globbing的文件替换) l Command is executed.(执行命令) B、 Type of commands l Aliases l Keywords l

9、Functions l Built-in commands l Executable programs C、 Processes and the shell 1、 what processes are running? l the ps command l the pstree/ptree command 2、 Whet are system calls? 3、 Creating processes D、 Environment and inheritance 1、 ownership and permissions 2、 the file creation m

10、ask 3、 changing permissions and ownership l chmod command l chown command 4、 the working directory 5、 variables E、 redirection and pipes 1、 file descriptors (0:标准输入 1:标准输出 2:标准错误输出) 2、 redirection 3、 pipes F、 the shell and signals A. the signal can be ignored B. the processes can be stop

11、ped C. the processes can be continued D. the signal can be caught by a function defined in the program. G、 Executing commands from scripts Go into your favorite editor and type in a set of unix/Linux commands, one per line. Indicate what shell you want by placing the pathname of the shell after

12、the #! On the first line. Save your file and turn on the execute permissions so that you can run it. Execute your program just as you would any other unix/Linux command. 二、 Shell programming Quick Start 1、 Taking a peek at shell scripts A. The c shell and TC shell emulate the c language synta

13、x whereas Bourne shell is based on an older programming language called Algol. B. The bash and korn shells tend to be combination of both the Bourne and C shells, although these shells originated from the Bourne shell 2、 Sample scripts: Comparing the Major shells A. Before Getting Started You mu

14、st have a good handle on UNIX/Linux commands. If you do not know the basic commands, you cannot do much with shell programming. B. VI 3、 The c and TC shell syntax and constructs A、 The shbang line Example: #!/bin/csh or #!/bin/tcsh B、 Comments Example: #This is a comment. C、 Wildcards Exampl

15、e: rm * ; ls ??;cat file[1-3];!! Echo “How are you?” Echo Oh boy\! D、 Displaying output Example Echo “Hello to you\!” E、 Local variables Set variables_name = value Set name=”Tom Jones” F、 Global variables Setenv VARIABLE_NAME value Setenv PRINTER shakespeare G、 Extracting values from

16、 variables Echo $variable_name Echo $name Echo $PRINTER H、 Reading user input Echo “what is your name?” Set name = $< I、 Arguments Scriptname arg1 arg2 arg3 … Echo $1 $2 $3 Echo $* J、 Arrays Set word_list = (word1 word2 word3) Echo $word_list[2] Echo $word_list[1] Echo $word_list or $

17、word_list[*] K、 Command substitutioin Set variable_name = `command` Echo $variable_name L、 Arithmetic @n =5+5 Echo $n M、 Operators N、 Conditional statements O、 Loops P、 File testing 4、 The bourne shell syntax and constructs A、 the shbang line B、 comments C、 wildcards(通配符) D、 dis

18、playing output E、 local variables variable_name = value F、 global variables VARIABLE_NAME=value Export VARIABLE_NAME G、 Extracting values from variables H、 Read user input Echo “what is your name?” Read name Read name1 name2 … I、 Arguments (positional parameters) $scriptname arg1 arg2 ar

19、g3 … Echo $1 $2 $3 J、 Arrays (positional parameters) Set word1 word2 word3 Echo $1 $2 $3 K、 Command substitution Variable_name = `command` Echo $variable_name L、 Arithmetic N = `expr 5+5` Echo $n M、 Opterators 5、 The korn shell Constructs A、 the shbang line #!/bin/ksh B、 comments #

20、this program will test some files C、 wildcards rm *;ls ??;cat file[1-3]; echo “How are you?” D、 displaying output echo “who are you?” print “how are you?” E、 local variables variable_name = value typeset variable_name = value name = “John Doe” F、 global variables export VARIABLE_NAME = v

21、alue export PATH=/bin:/usr/bin; G、 extracting values from variables echo $variable_name echo $name H、 read user input print –n “what is your name?” read name I、 arguments $scriptname arg1 arg2 arg3 … Echo $1 $2 $3 … J、 arrays set apples pears peaches echo $1 $2 $3 K、 arithmetic typese

22、t –i variable_name L、 command substitution variable_nae = `command’ variable_name = $(command) echo $variable_name M、 operators N、 conditional statements O、 loops P、 file testing 6、 the bash shell constructs 三、 regular expressions and pattern matching 1、 definition and exam

23、ple what is a regular expression? A regular expression is just a pattern of characters used to match the same characters in a search. Vim 编辑器: :1,$s/kernel/admin/g (替换文中的kernel为admin,做一个全局替换) 撤销操作:按键盘上的u; 2、 regular expression metacharacters vim 编辑器: :1,$s/\<[Kk]ernel\>/admin/g (替换稳重

24、的K/kernel为admin,做一个全局替换) 3、 combining regular expression matacharacters 四、 The grep family 1、 the meaning of grep l the name grep can be traced back to the editor. If you invoked that editor and wanted to search for a string, you would type at the ex prompt: n /pattern/p l The first l

25、ine containing the string pattern would be printed as “p” by the print command. If you wanted all the lines that contained pattern to be printed, you would type: n g/pattern/p l when g precedes pattern, it means “all lines in the file,” or “perform g global substitution.” Because the search patter

26、n is called a regular expression, we can substitute RE for pattern and the command reads n g/RE/P 2、 how grep works l the grep command searches for a pattern of characters in a file or multiple files. If the pattern contains whitespace, it must be quoted. The pattern is either a quoted string or

27、a single word, and all other words following it are treated as filenames. Grep sends its ouput to the screen and does not change or affect the input file in anyway. l Format Grep word filename filename l Metacharacters 3、 Metacharacters A metacharacter is a character that represents something o

28、ther than itself. ^ and $ are examples of metacharacters. 4、 Grep and exit status The grep command is very useful in shell scripts, because it always returns and exit status to indicate whether it was able to locate the pattern or the file you were looking for. If the pattern is found, gre

29、p returns an exit status of 0, indicating success; if grep cannot find the pattern, it returns 1 as its exit status; and if the file cannot be found, grep returns an exit status of 2 5、 Grep with pipes Instead of taking its input from a file, grep often gets its input from a pipe Etc. Ls –l | gre

30、p ‘^d’ 6、 Fgrep The fgrep command behaves like grep, but does not recognize any regular expression metacharacters as being special. All characters represent only themselves. A caret is simply a caret, a dollar sign is a dollar sign, and so forth. 7、 Linux and GNU grep 8、 Grep –E or

31、 egrep 五、 Sed the streamlined editor 1、 what is sed? Sed is a streamlined, noninteractive editor. It allows you to perform the same kind of editing tasks used in the vi and ex editors. 2、 Version of sed Linux uses the GNU version of sed, copyrighted by the free software foundation. This

32、 version is almost identical to the sed provided by standard UNIX distributions. Sed –version 3、 How does sed work? 4、 Regular expressions Sed, like grep, searches for patterns in files using regular expressions. Regular expressions are patterns of characters enclosed in forward slashes for

33、 searches and substitutions. 5、 Addressing n Format Sed ‘command’ filename(s) n Example Sed ‘1,3d’ myfile Sed –n ‘/[Jj]ohn/p’ datafile 6、 Command and options 7、 How to modify a file with sed Sed is a nondestructive editor. It will display the edits you make on your screen, b

34、ut it will not change the file you are editing. To really reflect the edits in the file, you must redirect the output to another file, and then rename the orginal file Example: Sed ‘1,3d’ filex > temp Mv temp filex 8、 Error messages and exit status When sed encounters a syntax error, it sen

35、ds a pretty straightforward error message to standard error, but if it cannot figure out what you did wrong, sed gets “garbled” which we could guess means confused. If the syntax is error-free, the exit status that sed returns to the shell is a zero for success and nonzero integer for failure. 9、 M

36、etacharacters Like grep, sed supports a number of special metacharacters to control pattern seaching. 10、 Sed example n Printing: the p command Sed ‘/north/p’ datafile Sed –n ‘/north/p’ datafile n Deleting: the d command Sed ‘3d’ datafile Sed –n ‘3,$d’ datafile Sed ‘$d’ datafile Sed ‘/no

37、rth/d’ datafile n Substitution: the s command Sed ‘s/west/north/g’ datafile Sed –n ‘s/^west/north/p’ datafile Sed ‘s/[0-9][0-9]$/&.5/’ datafile Sed –n ‘s/hemenway/jones/gp’ datafile Sed –n ‘s/\(Mar\)got/\1ianne/p’ datafile Sed ‘s#3#88#g’ datafile n Range fo selected lines: the comma Sed –n

38、 ‘/west/,/east/p’ datafile Sed –n ‘5,/^northeast/p’ datafile Sed ‘west/,/east/s/$/**/VACA**/’ datafile n Multiple edits: the e command Sed –e ‘1,3d’ –e ‘s/hemenway/jones/’ datafile n Reading from files: the r command Sed ‘/suan/r newfile’ datafile n Writing to files: the w command Sed –n ‘/n

39、orth/w newfile’ datafile n Appending: the a command Sed ‘^north /a\-àBOOKBOOKEß--‘ datafile n Inserting: the I command Sed ‘/eastern/i\-àBOOBOOKEß-‘ datafile n Changing: the c command Sed ‘/eastern/c\ -à BOOBOOKEß-‘ datafile n Next: the n command Sed ‘/eastern/{n;s/AM/Archie/;}’ datafile n

40、Transform: the y command Sed ‘1,3y/asdfgajasdflawehfihaiwehfihasd/ADSFASKDHFLIASFI/’ datafile n Quit: the q command Sed ‘5q’ datafile Sed ‘/Lewis/{s/Lewis/Joseph/;q;}’ datafile n Holding and getting: the h and g commands Sed –e ‘/northeast/h’ –e ‘$G’ datafile Sed –e ‘/WE/{h;d;}’ –e ‘/CT/{G;}’ datafile Sed –e ‘/northeast/h’ –e ‘$g’ datafile Sed –e ‘/WE/{h;d;}’ –e ‘/CT/{g;}’ datafile n Holding and exchanging: the h and x command Sed –e ‘/Patricia/h’ –e ‘/Margot/x’ datafile 11、 Sed scripting n Sed script examples n n

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服