here is my problem...
cat > tablextract2.sql
CREATE TABLE `Table11` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`entityName` enum('Lines','EndUsers') COLLATE utf8_unicode_ci NOT NULL,
`parentAllianceMigrationProjectId` int(11) NOT NULL,
`lastModified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
colname1="id"
flag=0
grep -w -i $colname1 tablextract2.sql | while read line ; do
echo "$line"
flag=1
echo "flag: $flag"
done
echo "flag: $flag"
output
`id` int(11) NOT NULL AUTO_INCREMENT,
flag: 1
PRIMARY KEY (`id`)
flag: 1
flag: 0
when the pointer comes out of the while loop why is my flag set to 0 again.. how to overcome this.. is there any global/local variable thing in shell scripts??
