Home > Programming > Shell Programming
basic shell programming
Sort Desciption:bash derives much of its programming functionality from shell variables. Weve ... builtin variables that are vital to shell programming. ...
Content Inside:UntitledPage 1Page 2This is the Title of the Book eMatter EditionCopyright 2005 OReilly & Associates Inc. All rights reserved.81Chapter 4CHAPTER 4Basic Shell ProgrammingIf you have become familiar with the customization techniques we presented in theprevious chapter you have probably run into various modifications to your environment that you want to make but cantyet. Shell programming makes these possible.bash has some of the most advanced programming capabilities of any commandinterpreter of its type. Although its syntax is nowhere near as elegant or consistent asthat of most conventional programming languages its power and flexibility are comparable. In fact bash can be used as a complete environment for writing softwareprototypes.Some aspects of bash programming are really extensions of the customization techniques we have already seen while others resemble traditional programming language features. We have structured this chapter so that if you arent a programmeryou can read this chapter and do quite a bit more than you could with the information in the previous chapter. Experience with a conventional programming languagelike Pascal or C is helpful (though not strictly necessary) for subsequent chapters.Throughout the rest of the book we will encounter occasional programming problems called tasks whose solutions make use of the concepts we cover.Shell Scripts and FunctionsA script (a file that contains shell commands) is a shell program. Your .bash_profileand environment files discussed in the previous chapter are shell scripts.You can create a script using the text editor of your choice. Once you have createdone there are two ways to run it. One which we have already covered is to typesource scriptname. This causes the commands in the script to be read and run as ifyou typed them in.The second way to run a script is simply to type its name and hit RETURN just as ifyou were invoking a builtin command. This of course is the more convenient way.This method m ...
Source:
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Related Files
basic shell programming
Filed under: Programming and Shell Programmingbash derives much of its programming functionality from shell variables. Weve ... builtin variables that are vital to shell programming. ...
Unix Shell Scripts
Filed under: Programming and Shell Programmingthat file is called shell script language. Like other programming languages it has variables and flow control. statements (e.g. ifthenelse while for ...
UNIX Shell Programming
Filed under: Programming and Shell ProgrammingPage 1 of 1 ITC_UNIXsp ExecuTrain Course Outline UNIX Shell Programming IT0001 3 Days Description Students learn to read, write, and debug shell scripts, thus increasing ...
