COMP421
Unix Environment for Programmers
Lecture 06: Shell scripts continues_______________________________

Jeff Wiegley, Ph.D.
Computer Science
jeffw@csun.edu

09/12/2005

1


Shell substitution:____________________________________

2


Variables are substituted____________________________

The presence of an string that begins with $ is considered a variable and the contents of the variable are substituted for the name.

This is confusing because somethings won’t work as expected.

      $myphrase="hello there"  
      grep $myphrase targetfile  
    

actual yields... grep hello there targetfile which will search for “hello” in the two files there and targetfile.

grep "$myphrase" targetfile would fix this problem

3