Introduction to the shell
Số trang: 34
Loại file: ppt
Dung lượng: 305.00 KB
Lượt xem: 27
Lượt tải: 0
Xem trước 4 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Shell là Là một chương trình tiện ích với Linux là hệ thống phục vụ một giao diện giữa người sử dụng, hạt nhân - A shell is a utility program with the Linux system that serves as an interface between the user and the kernel
Nội dung trích xuất từ tài liệu:
Introduction to the shellObjectives Inthislesson,youwilllearnto: • DefinetheroleandfeaturesoftheLinuxshell • Usetheshellasacommandinterpreter • Createuserdefinedvariables • Useshellenvironmentvariables • CreateshellscriptsinLinuxIntroductiontotheShell• Ashell: • Isautilityprogramwiththe Linuxsystemthatservesas aninterfacebetweenthe userandthekernel • Playsanimportantroleof commandinterpretationfor thekernel• Theadjacentfigureshowsthe architectureoftheLinuxoperating system.FeaturesofaShell • Theshellhasthefollowingfeatures: • Interactiveprocessing • Backgroundprocessing • Input/outputredirection • Pipes • Shellscripts • Shellvariables • Programminglanguageconstructs • Commandhistory • Jobcontrol • Filenamecompletion • CommandcompletionShellasaCommandInterpreter • Theshell: • Readsthecommand • Locatesthefileinthedirectoriescontainingutilities • Loadstheutilityintomemory • ExecutestheutilityShellasaCommandInterpreter(Contd.) Theshellcreatesachildshellfortheexecutionofautility Theshellrequeststhekernelforanyhardwareinteraction UnixShells • SomeofthepopularUnixShellsare: • BourneShell:sh istheexecutablefilenameforthisshell • CShell:cshistheexecutablefilenameforthisshell • KornShell:Theexecutablefilenameisksh • RestrictedShell:IstypicallyusedforguestloginsLinuxShells • SomeofthepopularshellsavailableinLinuxare: • Bash: • Isanacronymfor‘BourneAgainShell’andisthedefaultshellformostLinux systems • Usesthesymboliclinksh • Tcsh: • Isanacronymfor‘Tom’sCshell’alsoknownastheTCshell • ItisanenhancementoftheCshell • Usesthesymboliclinkcsh • Canbeexecutedbyusingeithercshortcshattheshellprompt • ASH: • Isusuallysuitableonmachinesthathaveverylimitedmemory • Usesthesymboliclink,bshinFedoraCore2ChangingtheDefaultShell • Thedefaultshelloftheuserisspecifiedinthe/etc/passwdfile. • Thechshcommandcanbeusedforchangingthedefaultshellfortheuser [steve@linuxpc1 /etc]$ chsh ↵ Changing shell for Steve. Password: New shell [/bin/bash]: /bin/csh Shell changed. • Thefullpathforthenewshellhastobegivenwhenchangingtheshell. • AfterthedefaultshellhasbeenchangedfromBashtocsh, theentryfortheuser, steve,inthepasswdfilechangesasfollows steve:x:503:513:steve walker:/home/steve:/bin/cshShellScripts • AShellscript: • StoresasequenceoffrequentlyusedLinuxcommandsinafile • Enablestheshelltoreadthefileandexecutethecommandsinit • Allowsmanipulationofvariables,flowofcontrolanditerationconstructsthatmake programmingpossibleTheecho Command • TheechoCommand • Displaysmessagesonthescreen • Displaysthetext,enclosedwithindoublequotes • Putsanewlinecharacterattheendofthetextbydefault $ echo This is an example of the echo command ↵ This is an example of the echo command $ _ExecutingaShellScript • Ashellscriptcanbeexecuted: • Inanewshellby 1. Firstgrantingtheexecutepermissiontothespecifiedshellscript 2. Theninvokingitsnameatthe$prompt $ chmod u+x magic ↵ [ChangeFileAccessPermission] $ magic ↵ [Executetheshellscript] • Inthecurrentshellbyusingthedot(.)commandwiththescriptnameintheBash shell $ . magic ↵ [IntheBashshells]CreatingVariables • Variablesinshellscripts: • arenotdeclaredasintegersorcharacters • aretreatedascharacterstrings • canbemathematicallymanipulated • donothavetobeexplicitlydeclared • canbecreatedatanypointoftimebyasimpleassignmentofvalue • Thesyntaxforcreatingavariableis: = • Variablescanbecreated: • Inshellscripts:Avariablecreatedwithinashellscriptislostwhenthescriptstops executing. • Attheshellprompt:Avariablecreatedatthepromptremainsinexistenceuntilthe shellisterminated.Referencing ...
Nội dung trích xuất từ tài liệu:
Introduction to the shellObjectives Inthislesson,youwilllearnto: • DefinetheroleandfeaturesoftheLinuxshell • Usetheshellasacommandinterpreter • Createuserdefinedvariables • Useshellenvironmentvariables • CreateshellscriptsinLinuxIntroductiontotheShell• Ashell: • Isautilityprogramwiththe Linuxsystemthatservesas aninterfacebetweenthe userandthekernel • Playsanimportantroleof commandinterpretationfor thekernel• Theadjacentfigureshowsthe architectureoftheLinuxoperating system.FeaturesofaShell • Theshellhasthefollowingfeatures: • Interactiveprocessing • Backgroundprocessing • Input/outputredirection • Pipes • Shellscripts • Shellvariables • Programminglanguageconstructs • Commandhistory • Jobcontrol • Filenamecompletion • CommandcompletionShellasaCommandInterpreter • Theshell: • Readsthecommand • Locatesthefileinthedirectoriescontainingutilities • Loadstheutilityintomemory • ExecutestheutilityShellasaCommandInterpreter(Contd.) Theshellcreatesachildshellfortheexecutionofautility Theshellrequeststhekernelforanyhardwareinteraction UnixShells • SomeofthepopularUnixShellsare: • BourneShell:sh istheexecutablefilenameforthisshell • CShell:cshistheexecutablefilenameforthisshell • KornShell:Theexecutablefilenameisksh • RestrictedShell:IstypicallyusedforguestloginsLinuxShells • SomeofthepopularshellsavailableinLinuxare: • Bash: • Isanacronymfor‘BourneAgainShell’andisthedefaultshellformostLinux systems • Usesthesymboliclinksh • Tcsh: • Isanacronymfor‘Tom’sCshell’alsoknownastheTCshell • ItisanenhancementoftheCshell • Usesthesymboliclinkcsh • Canbeexecutedbyusingeithercshortcshattheshellprompt • ASH: • Isusuallysuitableonmachinesthathaveverylimitedmemory • Usesthesymboliclink,bshinFedoraCore2ChangingtheDefaultShell • Thedefaultshelloftheuserisspecifiedinthe/etc/passwdfile. • Thechshcommandcanbeusedforchangingthedefaultshellfortheuser [steve@linuxpc1 /etc]$ chsh ↵ Changing shell for Steve. Password: New shell [/bin/bash]: /bin/csh Shell changed. • Thefullpathforthenewshellhastobegivenwhenchangingtheshell. • AfterthedefaultshellhasbeenchangedfromBashtocsh, theentryfortheuser, steve,inthepasswdfilechangesasfollows steve:x:503:513:steve walker:/home/steve:/bin/cshShellScripts • AShellscript: • StoresasequenceoffrequentlyusedLinuxcommandsinafile • Enablestheshelltoreadthefileandexecutethecommandsinit • Allowsmanipulationofvariables,flowofcontrolanditerationconstructsthatmake programmingpossibleTheecho Command • TheechoCommand • Displaysmessagesonthescreen • Displaysthetext,enclosedwithindoublequotes • Putsanewlinecharacterattheendofthetextbydefault $ echo This is an example of the echo command ↵ This is an example of the echo command $ _ExecutingaShellScript • Ashellscriptcanbeexecuted: • Inanewshellby 1. Firstgrantingtheexecutepermissiontothespecifiedshellscript 2. Theninvokingitsnameatthe$prompt $ chmod u+x magic ↵ [ChangeFileAccessPermission] $ magic ↵ [Executetheshellscript] • Inthecurrentshellbyusingthedot(.)commandwiththescriptnameintheBash shell $ . magic ↵ [IntheBashshells]CreatingVariables • Variablesinshellscripts: • arenotdeclaredasintegersorcharacters • aretreatedascharacterstrings • canbemathematicallymanipulated • donothavetobeexplicitlydeclared • canbecreatedatanypointoftimebyasimpleassignmentofvalue • Thesyntaxforcreatingavariableis: = • Variablescanbecreated: • Inshellscripts:Avariablecreatedwithinashellscriptislostwhenthescriptstops executing. • Attheshellprompt:Avariablecreatedatthepromptremainsinexistenceuntilthe shellisterminated.Referencing ...
Tài liệu có liên quan:
-
Giáo trình Lý thuyết hệ điều hành: Phần 1 - Nguyễn Kim Tuấn
110 trang 493 0 0 -
Giáo trình Nguyên lý các hệ điều hành: Phần 2
88 trang 309 0 0 -
Giáo trình Nguyên lý hệ điều hành (In lần thứ ba): Phần 1 - PGS.TS. Hà Quang Thụy
98 trang 306 0 0 -
175 trang 305 0 0
-
173 trang 283 2 0
-
Đề tài nguyên lý hệ điều hành: Nghiên cứu tìm hiểu về bộ nhớ ngoài trong hệ điều hành Linux
19 trang 271 0 0 -
Bài thảo luận nhóm: Tìm hiểu và phân tích kiến trúc, chức năng và hoạt động của hệ điều hành Android
39 trang 265 0 0 -
Giáo trình Hệ điều hành: Phần 2
53 trang 257 0 0 -
Bài thuyết trình nhóm môn Hệ điều hành: Tìm hiểu về cách quản lý tệp
17 trang 239 0 0 -
Phần III: Xử lý sự cố Màn hình xanh
3 trang 237 0 0