This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2019:unix:projects:spf1 [2019/04/16 16:04] – [script2: pigrep] wedge | haas:spring2019:unix:projects:spf1 [2019/04/18 18:41] (current) – [Objective] wedge | ||
---|---|---|---|
Line 18: | Line 18: | ||
* an initialization script | * an initialization script | ||
* an incrementing 8-bit binary counter (0-255) | * an incrementing 8-bit binary counter (0-255) | ||
- | * a decreminting | + | * a decrementing |
* a strobing light sequence (back and forth) | * a strobing light sequence (back and forth) | ||
Line 158: | Line 158: | ||
The purpose of this script is to create a fancy flashing pattern, lighting up and turning off the LEDs to create wavy or "back and forth" style visual effects. | The purpose of this script is to create a fancy flashing pattern, lighting up and turning off the LEDs to create wavy or "back and forth" style visual effects. | ||
- | ====Only specifying numeric pattern==== | ||
- | In the event only a pattern is provided, search through the PI data for the provided pattern, displaying each match to STDOUT. | ||
- | |||
- | For example: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 26 26 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | ====one result per line==== | ||
- | Using the **byline** option, instead of displaying results horizonally, | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 26 | ||
- | 26 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | ====compute offsets from start of digits==== | ||
- | The **offset** argument will, instead of displaying the numeric matches (which, aside from counting are of dubious value) will display how many digits away from the start of the PI digits the pattern resides. | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 7 22 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | With an example like this, we should easily be able to verify its correctness: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664 | ||
- | lab46: | ||
- | 2626 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | ====mixing options (offset, byline)==== | ||
- | And we can mix options (in any order): | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 7 | ||
- | 22 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | ====Using atend with offset==== | ||
- | The **atend** option, issued by itself, has no impact on operations: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 26 26 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | So we need to combine it with the **offset** option to make an impact: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 8 23 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | ====dropping the leading 3==== | ||
- | With the **drop3** option, we merely exclude the leading 3 of pi from our calculations. This should result in everything being "off by one" from previous outputs (with any combination of arguments): | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 7 22 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | ====Using MAX to limit processing==== | ||
- | Sometimes, a pattern may produce an untenable quantity of results. We may wish to restrict it, and can do so with the aid of setting the **MAX** variable. | ||
- | |||
- | Take this request, which produces numerous results: | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | We can cut that down to a smaller quantity by setting MAX accordingly (let's say, limit to 4 matches): | ||
- | |||
- | <cli> | ||
- | lab46: | ||
- | 2 2 2 2 | ||
- | lab46: | ||
- | </ | ||
- | |||
- | You could also **export** MAX, mitigating the need to manually specify it for each run. | ||
=====Specifications===== | =====Specifications===== | ||
- | Evaluation will be based on correctness of values as well as on formatting/ | + | Evaluation will be based on correctness of values as well as on commenting/formatting/ |
- | + | ||
- | You'll notice that everything lines up and is positioned similarly: | + | |
* groupwork! This project is specifically designed to be performed in groups. | * groupwork! This project is specifically designed to be performed in groups. | ||
* I want to see groups ranging from a minimum of 2 people, to a maximum of 4 people. Any less and any more are not allowed. | * I want to see groups ranging from a minimum of 2 people, to a maximum of 4 people. Any less and any more are not allowed. | ||
+ | * There are 4 pi's, 1 per table. There are 11 total people in the class, and on average 9 people regularly showing up; this could mean three groups of three (for example). | ||
* EVERY group member needs to be identified in your scripts (in a comment listing everyone). | * EVERY group member needs to be identified in your scripts (in a comment listing everyone). | ||
+ | * ONE GROUP PER TABLE (no group should share a pi with another). | ||
* EVERY group member needs to be familiar with the end products | * EVERY group member needs to be familiar with the end products | ||
* EVERY group member needs to submit a copy of the scripts (they should all be identical- I will check) | * EVERY group member needs to submit a copy of the scripts (they should all be identical- I will check) | ||
* in the event you feel other group members have not lived up to their obligations, | * in the event you feel other group members have not lived up to their obligations, | ||
* EVERY group member needs to do an approximately equal portion of the work. Slackers should be called out (I'll be keeping an eye out as well) and they will lose credit. | * EVERY group member needs to do an approximately equal portion of the work. Slackers should be called out (I'll be keeping an eye out as well) and they will lose credit. | ||
+ | * EACH group member is responsible for prolifically commenting and demonstrating functionality of ONE of the scripts. The commenter should be identified at the top of the particular script. No one person should be commenting all the scripts. | ||
* This project is designed to be done DURING class time. It may offer up some useful insights into other projects (that you're doing on your own). | * This project is designed to be done DURING class time. It may offer up some useful insights into other projects (that you're doing on your own). | ||
- | * You need to check your arguments to ensure they are present and valid. | + | * You need to check your arguments to ensure |
- | * all mentioned arguments implementing their indicated functionality | + | * all mentioned arguments implementing their indicated functionality |
- | * help takes priority over other options | + | * any invalid arguments |
- | * **atend** has no appreciable impact unless **offset** is also specified | + | |
- | * any invalid arguments should | + | |
* your script needs to commence with a proper **shabang** to run using bash; your script needs to end with an " | * your script needs to commence with a proper **shabang** to run using bash; your script needs to end with an " | ||
* comments and indentation are required and necessary | * comments and indentation are required and necessary | ||
* comments should explain how or why you are doing something | * comments should explain how or why you are doing something | ||
* indentation should be consistent throughout the script (no mixing of different indentation units; no mixing of tabs and spaces) | * indentation should be consistent throughout the script (no mixing of different indentation units; no mixing of tabs and spaces) | ||
- | * indentation is to be no less than 3 on-screen spaces (I recommend tabstops of 4). | + | * indentation is to be no less than 3 on-screen spaces (I recommend tabstops/ |
* continuing with our shell scripting, your scripts will need to employ in a core/ | * continuing with our shell scripting, your scripts will need to employ in a core/ | ||
* variables | * variables | ||
* command-line argument parsing and usage | * command-line argument parsing and usage | ||
- | * command-line pipelines | ||
- | * command expansions | ||
- | * regular expressions | ||
* conditional/ | * conditional/ | ||
* loops | * loops | ||
+ | * if appropriate: | ||
+ | * command-line pipelines | ||
+ | * command expansions | ||
+ | * regular expressions | ||
* your logic needs to: | * your logic needs to: | ||
* flow (one thing leads into the next, as best as possible) | * flow (one thing leads into the next, as best as possible) | ||
Line 318: | Line 222: | ||
This can be in the form of comments in your script, or even a separate file submitted at time of submission (if a file, be sure to make mention of it in your script so I can be sure to look for it). | This can be in the form of comments in your script, or even a separate file submitted at time of submission (if a file, be sure to make mention of it in your script so I can be sure to look for it). | ||
- | |||
=====Submission===== | =====Submission===== | ||
- | By successfully performing this project, you should have a fully functioning set of scripts by the names **pigen** and **pigrep**, which are all you need to submit for project completion (no steps file, as your " | + | By successfully performing this project, you should have a fully functioning set of scripts by the names **script1** through |
To submit this project to me using the **submit** tool, run the following command at your lab46 prompt: | To submit this project to me using the **submit** tool, run the following command at your lab46 prompt: | ||
<cli> | <cli> | ||
- | $ submit unix spf0 pigen pigrep | + | $ submit unix spf1 script1 script2 script3 script4 |
- | Submitting unix project "spf0": | + | Submitting unix project "spf1": |
- | -> pigen(OK) | + | -> script1(OK) |
- | -> pigrep(OK) | + | -> script2(OK) |
+ | -> script3(OK) | ||
+ | -> script4(OK) | ||
SUCCESSFULLY SUBMITTED | SUCCESSFULLY SUBMITTED | ||
Line 339: | Line 244: | ||
< | < | ||
- | 26:spf0:final tally of results (26/26) | + | 52:spf1:final tally of results (52/52) |
- | *:spf0: | + | *:spf1: |
- | *:spf0:scripts effectively utilize command-line arguments | + | *:spf1:initialization script logic present and functions |
- | *:spf0:scripts effectively utilize command expansions | + | *:spf1:initialization logic uses loop to automate task [4/4] |
- | *:spf0:scripts effectively utilize regular expressions | + | *:spf1:incrementation script logic present and functions |
- | *:spf0:scripts effectively utilize selection structures | + | *:spf1:counter script logic is centrally based on loop [4/4] |
- | *:spf0:scripts effectively utilize looping structures | + | *:spf1:counter script logic does adequate error checking |
- | *:spf0:scripts are proper bash scripts with shabang | + | *:spf1:decrementation script logic present |
- | *:spf0:pigrep displays values in proper orientation | + | *:spf1:flashy script logic present and functions |
- | *:spf0:pigrep accurately displays values as requested | + | *:spf1:scripts appropriately call the initialization logic [4/4] |
- | *:spf0: | + | *:spf1: |
- | *:spf0:pigen operates according to specifications | + | *:spf1:scripts effectively utilize selection structures |
- | *:spf0:pigrep operates according to specifications | + | *:spf1:scripts effectively utilize looping structures |
- | *:spf0:script logic is organized | + | *:spf1:scripts are proper bash scripts with shabang |
</ | </ | ||