




已阅读5页,还剩65页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
UNIXShell ScriptingBasics Agenda Whatisashell Ashellscript IntroductiontobashRunningCommandsAppliedShellProgramming Whatisashell Whatisashell bin bash Whatisashell bin bash Whatisashell Whatisashell AnyProgramButthereareafewpopularshells BourneShells bin sh bin bash Bourne AgainShell SteveBourne OtherCommonShells CShell bin csh TurboCShell bin tcsh KornShell bin ksh Anaside WhatdoImeanby bin CShell bin csh TurboCShell bin tcsh KornShell bin ksh Anaside WhatdoImeanby bin bin usr bin usr local bin sbin usr sbin usr local sbin tmp dev home borwicjh WhatisaShellScript ATextFileWithInstructionsExecutable WhatisaShellScript cat hello sh MY PROGRAM bin shecho Hello world MY PROGRAM chmod xhello sh hello shHello world WhatisaShellScript ATextFile cat hello sh MY PROGRAM bin shecho Hello world MY PROGRAM chmod xhello sh hello shHello world Anaside Redirection cat tmp myfilecat tmp myfilecat2 tmp myerrcat tmp x2 1 0 1 2 WhatisaShellScript HowToRun cat hello sh MY PROGRAM bin shecho Hello world MY PROGRAM chmod xhello sh hello shHello world WhatisaShellScript WhatToDo cat hello sh MY PROGRAM bin shecho Hello world MY PROGRAM chmod xhello sh hello shHello world WhatisaShellScript Executable cat hello sh MY PROGRAM bin shecho Hello world MY PROGRAM chmod xhello sh hello shHello world WhatisaShellScript Runningit cat hello sh MY PROGRAM bin shecho Hello world MY PROGRAM chmod xhello sh hello shHello world Findingtheprogram PATH hello shechovs usr bin echo echo PATH bin usr bin usr local bin home borwicjh bin whichecho usr bin echo VariablesandtheEnvironment hello shbash hello sh Commandnotfound PATH PATH hello shHello world Anaside Quoting echo USER USER echo USER borwicjh echo echo deacnet sct deacnet sct echo VariablesandtheEnvironment env variablespassedtosub programs NEW VAR Yes echo NEW VARYes env PATHbutnotNEW VAR exportNEW VAR env PATHandNEW VAR WelcometoShellScripting Shebang TheEnvironment PATH Input Output andError chmod HowtoLearn manmanbashmancatmanmanman kman kmanualLearningtheBashShell 2ndEd BashReference Cardshttp www tldp org LDP abs html Introductiontobash ContinuingLines echoThis Is A Very Long CommandLineThisIsAVeryLongCommandLine ExitStatus 0isTrue ls does not exist echo 1 echo 0 ExitStatus exit cat test sh TEST exit3 TEST chmod xtest sh test sh echo 3 Logic test test1 lt10 echo 0 test1 10 echo 1 Logic test test 1 lt10 thisstring this 1 10 Logic test f etc passwd f etc passwd f etc passwd a f etc shadow f etc passwd o f etc shadow Anaside forMath echo 1 2 3 echo 2 3 6 echo 1 3 0 Logic if ifsomethingthen elif acontractionof elseif elifsomething elsethen elsethen fi Logic if if USER eq borwicjh then elif acontractionof elseif elifls etc oratabthen elsethen fi Logic if seeifafileexistsif e etc passwd thenecho etc passwdexists elseecho etc passwdnotfound fi Logic for foriin123doecho idone Logic for foriin doecho Listing i ls l ireaddone Logic for foriin doecho Listing i ls l ireaddone Logic for foriin doecho Listing i ls l ireaddone Logic C stylefor for expr1 expr2 expr3 dolistdone Logic C stylefor LIMIT 10for a 1 a LIMIT a doecho n a done Logic while whilesomethingdo done Logic while a 0 LIMIT 10while a lt LIMIT doecho n a a a 1 done Counters COUNTER 0while e FILE COUNTER doCOUNTER COUNTER 1 doneNote racecondition ReusingCode Sourcing cat path to my passwords PW FTP USER sct PW echo FTP USER path to my passwords echo FTP USERsct VariableManipulation FILEPATH path to my output lis echo FILEPATH path to my output lis echo FILEPATH lis path to my output echo FILEPATH path to my output lis echo FILEPATH output lis Ittakesalongtimetobecomeabashguru RunningPrograms ReasonsforRunningPrograms CheckReturnCode GetJobOutputOUTPUT echo Hello OUTPUT echo Hello SendOutputSomewhereRedirection Pipes Pipes LotsofLittleToolsecho Hello wc c EmailNotification echo Message mail s Here syourmessage borwicjh wfu edu Dates DATESTRING date Y m d echo DATESTRING20060125 mandate FTPtheHardWay ftp n userver wfu edu FTP userusernamepasswordputFILE FTP FTPwithwget wget ftp user pass server wfu edu filewget r ftp user pass server wfu edu dir FTPwithcurl curl Tupload file uusername password ftp server wfu edu dir file Searching grep greprayra etc passwd grep rrayra etc grep rRAYRA etc grep riRAYRA etc grep rlirayra etc Searching find find home borwicjh name lis allfilesmatching lis find home borwicjh mtime 1 name lis lis ifmodifiedwithin24h manfind Searching locate locate lis fileswith lisinpath locatelog alsofinds var log messages AppliedShellProgramming MakeYourLifeEasier TABcompletionControl Rhistorycd StudyaUNIXEditor pushd popd cd tmp pushd var log var log tmp cd pwd var popd tmp Monitoringprocesses psps efps uoracleps Csshdmanps DOS ModeFiles usr bin bash MFTPtransferinASCII ordos2unixinfile outfile sqlplus JOB ZZZTEST PARAMS ZZZTEST PARAMS PARAMS USER BORWICJH sqlplus BANNER USER BANNER PW EOF setserveroutputonsetsqlprompt EXECUTEWF SATURN FZ Get Parameters JOB PARAMS PARAMS USER EOF sqlplus sqlplus USER PASS FILE SQL ARG1 ARG2 ARG3if ne0 thenexit1fiif e file sql should create then useSQL createdfile fiAskAmyLamy PassingArguments cat test sh TEST echo Yournameis 1 2 TEST chmo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 IEC 60068-3-14:2025 FR Environmental testing – Part 3-14: Supporting documentation and guidance – Developing a climatic sequential test
- 校园超市消防知识培训内容课件
- 校园消防知识培训课件演练
- 校园消防知识培训内容课件
- 药师专业考试试题及答案
- 初级底盘考试题及答案
- 金桥劳务面试题及答案
- 中国古建筑考试试题及答案
- 淘宝处罚考试题及答案
- 上海医疗队考试试题及答案
- 2025矿山承包合同范文
- 人教版(2024)数学七年级上册期末测试卷(含答案)
- 数字化数据中台技术方案
- 锁骨骨折的护理课件
- 《物业管理法规》课件
- 2024华为干部管理资料第7版
- 《复活》(节选)列夫托尔斯泰-精讲课件
- (完整版)投标文件范本(格式)
- 中国风肺胀中医护理方案
- GB/T 10433-2024紧固件电弧螺柱焊用螺柱和瓷环
- 2024年样板注塑机转让合同范本
评论
0/150
提交评论