aix系统应用基础10processes

上传人:仙*** 文档编号:171197136 上传时间:2022-11-24 格式:PPT 页数:17 大小:299.50KB
返回 下载 相关 举报
aix系统应用基础10processes_第1页
第1页 / 共17页
aix系统应用基础10processes_第2页
第2页 / 共17页
aix系统应用基础10processes_第3页
第3页 / 共17页
点击查看更多>>
资源描述
Course materials may not be reproduced in whole or in part without the prior written permission of IBM.5.04.1 Copyright IBM Corporation 2008 Unit 10Processes Copyright IBM Corporation 2008Unit ObjectivesAfter completing this unit,you should be able to:Define an AIX processDescribe the relationship between parent and child processesCreate and invoke shell scripts Copyright IBM Corporation 2008The Process EnvironmentProgramUser and group IDData Process ID(PID)Open filesParent Process ID(PPID)Current directoryProgram variables What Is a Process?lEach program runs in a process:lThe variable$shows the process ID of the current shell:$echo$4712lThe ps command shows the running processes:$ps-u team01 Copyright IBM Corporation 2008login:AIX SystemPID=202 -kshlogin:johnJohns Password:xxxxxx$_Environmentprogram/usr/bin/kshuidjohngidstafffiles/dev/tty1PID202Login Process Environment Copyright IBM Corporation 2008AIX System$cat kfileEnvironment during executionprogram/usr/bin/catuidjohngidstafffiles/dev/tty1 kfileparent -kshPID310PPID202PID=202 -kshPID=310 catProcess Environment Copyright IBM Corporation 2008$echo$202$ksh (Create a subshell)$echo$206$date(Run a command)Tue Jan 4 11:18:26 GMT 2000$(Exit the subshell)$echo$202 Subshell PID PPID -ksh 202 1 ksh 206 202 date 208 206Parents and Children Copyright IBM Corporation 2008$x=4$ksh$echo$x$x=1$echo$x4 Subshell Variables and Processes Variables are part of the process environment.Processes cannot access or change variables from another process.Copyright IBM Corporation 2008variableShellSubshellexport variable=valueActivity:Exporting Variables Copyright IBM Corporation 2008A shell script is a collection of commands stored in a text file$vi hello echo Hello,John.Today is:$(date)pwd ls:wq$What Is a Shell Script?Copyright IBM Corporation 2008$cat helloecho Hello,John.Today is:$(date)(1)pwd(2)ls(3)$ksh helloHello,John:Today is:Wed Sep 13 19:34(1)/home/john(2)books letter1 text2sarah(3)$_-ksh$ksh hellokshscript commands Subshell Invoking Shell Scripts(1 of 3)Copyright IBM Corporation 2008The shell uses the PATH variable to find executable programs.$cat helloecho Hello,John.Today is:$(date)(1)pwd(2)ls(3)$chmod+x hello$helloHello,John:Today is:Wed Sep 13 19:34(1)/home/john(2)books letter1 text2sarah(3)$_ Subshell Invoking Shell Scripts(2 of 3)Copyright IBM Corporation 2008$cat set_dirdir1=/tmp dir2=/usr$.set_dir$echo$dir1/tmp$echo$dir2/usr.(dot):Execution in the current shell?What is the value of dir1 and dir2,if set_dir is called without the dot?Invoking Shell Scripts(3 of 3)Copyright IBM Corporation 2008Exit Codes from CommandslA command returns an exit value to the parent process:0=Success 1-255=Other than successfullThe environment variable$?contains the exit value of the last command:$cd/etc/securityksh:/etc/security:Permission denied$echo$?1 Copyright IBM Corporation 2008Checkpoint1.When would you execute a shell script using the dot(.)notation?Why?2.What is the command that is used to carry down the value of a variable into the subshell?3.What would be the value of x at the end of the following steps?$(.login shell.)$ksh$x=50$export x$(what is the value of x set to now?)Copyright IBM Corporation 2008Checkpoint Solutions1.When would you execute a shell script using the dot(.)notation?Why?When you are using the script to change variable values in the current shell.2.What is the command that is used to carry down the value of a variable into the subshell?export variable_name3.What would be the value of x at the end of the following steps?$(.login shell.)$ksh$x=50$export x$(what is the value of x set to now?)x would have the value it had before starting the subshell.If the login shell had not set the variable,then after return from the subshell it would still not be set.Copyright IBM Corporation 2008ShellScriptsActivity:Shell Scripts Copyright IBM Corporation 2008Unit SummaryShell scripts can be invoked in three ways:$ksh scriptname(must have read permission)$scriptname(must have read and execute permission)$.scriptname(must have read permission)Each program runs in an AIX process.Every process has an environment in which it runs much of which is inherited from its initiating process,the parent process.
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 施工组织


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!