Difference between revisions of "OPS435 Lecture 9 - Bash"
(Created page with 'Today we've done a couple of walkthroughs, and started regular expressions. There will be lots of walkthroughs on the exam! Here are the ones we did in class: walk1.sh: <sourc…') |
m (Andrew moved page OPS435 Lecture 9 to OPS435 Lecture 9 - Bash) |
(No difference)
|
Latest revision as of 12:41, 22 August 2017
Today we've done a couple of walkthroughs, and started regular expressions. There will be lots of walkthroughs on the exam!
Here are the ones we did in class:
walk1.sh:
#!/bin/bash
echo -n " Stuff: "
i=5
for ((i=10; i < 20; i++))
{
echo -n $i
}
echo .
walk2.sh:
#!/bin/bash
cat passwd | while read ABC
do
N=`echo $ABC | cut -d: -f1`
S=`echo $ABC | cut -d: -f7`
echo "$N -> $S"
done
echo '$N -> $S'
For regular expressions we looked at egrep for searching, specifically the following special characters:
- ^ $ . *
And sed for search+replace. Sed is an important topic in this course, all that you need to learn about it is in the first few sections of this tutorial. By the end of the course you have to be comfortable at least with everything up to and including the "/p print" section.