/
The Linux Command Line Chapter 26 The Linux Command Line Chapter 26

The Linux Command Line Chapter 26 - PowerPoint Presentation

gabriella
gabriella . @gabriella
Follow
66 views
Uploaded On 2023-09-24

The Linux Command Line Chapter 26 - PPT Presentation

Top Down Design Prepared by Dr Reyes New York City College of Technology Top Down Design As scripts get larger and more complex they become more difficult to design code and maintain It is often a good idea to break large complex tasks into a series of small simple tasks ID: 1020430

variables car local shell car variables shell local park drive functions function tasks parking space maintain complex defined scripts

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "The Linux Command Line Chapter 26" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

1. The Linux Command Line Chapter 26Top Down DesignPrepared by Dr. Reyes, New York City College of Technology

2. Top Down DesignAs scripts get larger and more complex, they become more difficult to design, code and maintain. It is often a good idea to break large, complex tasks into a series of small, simple tasks.

3. Top Down DesignSubtasks for step 3, 8 “Park Car”1. Find parking space.2. Drive car into space.3. Turn off motor.4. Set parking brake.5. Exit car.6. Lock car.Instructions to buy foodGet in car.Drive to market.Park car.Enter market.Purchase food.Return to car.Drive home.Park car.Enter house.

4. Shell FunctionsFormal formSimpler form (preferred)Shell functions - “mini-scripts” that are located inside other scripts and can act as autonomous programs.

5. Sample Script with Functions

6. Global vs Local VariablesGlobal variables – variables that maintain their existence throughout the program and can be accessed anytime by any function.Local variables – variables defined inside shell functions and are only accessible within the shell function in which they are defined and cease to exist once the shell function terminates.Use keyword local in front of the variableAfter that, in a separate line assign a value to the variable

7. Example Using Local Variables