claProductVersion=`head -l ${amSqlCre}`
claProductVersion=`expr "${claProductVersion}" : 'Create Table \([^ ]*\) ('`
- Why we are using “:” here ?
- What ([^ ]*) is doing ?
- What does head -l doing ? As I did not find any “l” option in head man pages.
1
man exprwill tell youSTRING : REGEXPand this meansanchored pattern match of REGEXP in STRING2 The regexp
\([^ ]*\)will match strings likexxx.[^ ]means any character except whitespace. And*means repeat any times including zero. The\(and\)means showing the string matched. Without them, the result will the position the regexp matched.3 Still I guess there’s something wrong.
ldoesn’t make sense here. It should be a1.