So far we have not really learned any concepts that are truly hard to grasp. I will say we have seen a glimpse at what the power of Unix/Linux can do if used properly. I'm rather excited to truly begin learning the in depths of the system. It was also fun to use the ssh to log in off-site. Although nothing fancy it gave the feel of hacking.
Exploring the system so far has been enjoyable. The mage book defnitely goes by fast, I will likely have to read it again to make sure I caught everything. The games we found on the system are definitely entertaining, I just fear what will happen to my attention span in class.
Among many things we explored the magnificent spell vi! Allowing us even greater speed in completing_ our other spells! Along with Vi we also learned the history command (csh) and started to write our firsts_ scripts.
This is the week where it feels as if we have had an IV injection of coconut water!
This week we focused on the text in files. How to view, and manipulate whats in them without actually entering them. Such things like using the cat, head, tail and wc commands._ Along with variations of those commands, like how many lines of that file to view with head or tail commands. We also learned about regular expressions, possibly one of the most powerful and most annoying_ things to deal with in all of coding. Regular expressions are a set of character used to represent and analyze a patter. Some examples are:
. - match any single symbol
* - 0 or more of the previous
\< match start of word
\> match end of word
$ - match end of line
[ ] = match one of enclosed
[^ ] = do no match any of the enclosed
( ) =
This week as usual we further explored Vi, still not quite getting it but it will come with time.
This week we went over many interesting topics. The few ones that stood out to me were the loops. The loops were difficult to deal with, but once you were able to grasp the concepts of how they read each line,_ one line at a time, and when they need to be executed and how to end them.
This week we also learned about xte commands, and how to draw pictures using them. Learning how to control the cursor without touching the mouse was an eye opener, as it gave that 'hacker' feel that we all love._ Commands such as xte mousemove X Y and mousedown 1 and mouseclick 1 just made you get a smile on your face when it worked the way you wanted it to. (This is where I drew my Pokeball with xpaint and xte commands.)
This week we learned about the differences between scripts and programs (Scripts are high level programs with large amounts of overhead vs programas which are lower level with less overhead)as well we worked with loops and arrays. Instead of having to hard code large amounts of code, one can use arrays to simplify things with one value that is called upon many times._ As an example in class we wrote a script in class _
Hai.sh
i=0
echo -n “Enter score (-1 to end): ”
read score
while [ “$score” -ne “-1” ];do
battleexp[$i]=$score
echo -n “Enter score(-l to end): ”
read score
let i=$i+1
done
total=0
for1);do
let total=$total+${battleexp[$j]}
done
echo “Your total score is $total”
This was a lot of fun to make, it related the course to something almost all of us had in common, Pokemon :D
This week we spent the majority of the class time preparing for and doing the knowledge assessment. Which in all honesty
was over hyped in my opinion. It was difficult but the way it was presented could of been a lot worse for things. I was scared, but once
I saw how it was presented, I felt like all I really needed was time.
During the week we worked an a batch script that would check to see if a directory in our system already existed….This is what took the majority of both classes during the week
and we really did not do too much else that stood out to me.
(The program in my list is Paths.sh) #!/bin/bash
#
#
#
if [ -z “$1” ]; then
echo -n "Enter a path: "
read path
chk=`ls $path 2>&1|grep 'No such file'| wc -l`
if [ “$chk” -eq 0 ];then
path=`pwd`
fi
else
path=“$1”
fi
echo $path
cd $path
max=0
for file in `ls -1d *`; do
c=`echo $file| wc -c`
echo "c is $c"
data[$c]=${data[$c]}+1
if [ “$max” -lt “$c” ];then
max=$c
fi
done
for2);do
printf “%2d |” $i
if [ -z “${data[$i]}” ];then
data[$i]=0
fi
for3);do
echo -n “*”
done
echo
done
This week we learned about an amazing thing called RFC's. RFC's appeal to me because they are always the same, and change only slightly, they are around for new versions to keep a common standard. The project this week was creating a script that will run a website through our UID as a port number. This was done in testing.sh in my files and is listed below.
#!/bin/bash
#
while true;do
{ echo -e 'HTTP/1.1 200 OK\r\n'; cat /etc/motd; } | nc -l 5844
done
This week we worked on using the sed and grep commands with RegExp and Wildcards. For example during the class we were given a file of the html code to the winter courses, and we wanted to organize the code into a readable manner. My example code: cat winter2014-20131025.html|grep '^<th class=“ddtitle'|sed 's/^<th class=“ddtitle.*crn_in=…..”>g'|sed 's/<\/a><\/th>g'|sed 's/^\(.*\) - \(…..\) - \(.*\) - \(…\)$/\2:\3-\4:\1/g'