Open main menu

CDOT Wiki β

OPS435 Lecture 9 - Bash

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:


echo -n    " Stuff: "
for ((i=10; i < 20; i++))
  echo -n $i
echo .


cat passwd | while read ABC
  N=`echo $ABC | cut -d: -f1`
  S=`echo $ABC | cut -d: -f7`
  echo "$N -> $S"

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.