Unix Environment for Programmers
Lecture 06: Shell scripts continues_______________________________
Jeff Wiegley, Ph.D.
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.
grep $myphrase targetfile
actual yields... grep hello there targetfile which will search for “hello” in the two ﬁles there and targetfile.
grep "$myphrase" targetfile would ﬁx this problem