User Tools

Site Tools


journal:spring2020:acliteur:week9

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

journal:spring2020:acliteur:week9 [2020/03/19 07:31]
127.0.0.1 external edit
journal:spring2020:acliteur:week9 [2020/03/25 05:07] (current)
acliteur
Line 1: Line 1:
 =====unix week9===== =====unix week9=====
-----+03/25/2020
 ====MONTH Day, YEAR==== ====MONTH Day, YEAR====
 +This week I worked with Nick Reif, Erik Samson, and Tim Lee a lot on spf0. Nick and Tim worked on pigen, while Erik and I worked on pigrep. Pigrep became a problem as soon as multiple arguments were needed, other than that, it was okay.
  
-Filler text- your entry goes here; remove this line to receive full credit.+spf0 called for the use of arguments, and my task was to be able to find a quick and simple code for catching the arguments, Erik fleshed out the arguments and worked on getting them to work together. I googled how to get arguments to work even though we worked on argfun in class but there were new things to be found. ${*} contains all of the arguments, and I did not realize I could not echo it in the shell after I ran a command with arguments which caused me a lot of trouble. ${1} and other numbers contain the argument from the first argument and so on, ${0} contains the command. Then ${@} lists the arguments on new lines. ${#} shows how many arguments are ran.
  
 +To be able to identify the arguments in order for the code to run in a desired fashion, I used grep, and many If statements. The basic code throughout the project looked like: **argument=$(echo ${*} | grep -w '​argument'​ | wc -l)** then this was used by the code: **if [ ${argument} -gt 0]; then**. The function of the argument was nested in the if statement.
 +
 +Pigrep was essentially a grep command with custom arguments, so in order for it to function as a grep, it needed to find a pattern. So I set a pattern argument which looked like: **PATTERN=$(echo ${*} | grep -ow "​[0-9]*"​). This was used in every other argument for the command to actually search for the pattern.
journal/spring2020/acliteur/week9.txt · Last modified: 2020/03/25 05:07 by acliteur