I have sth like this :
mysql --user=$db_user --password=$db_pwd -e"$expQ" | while read name; do
if [ $name != 'name' ];then
COUNTER=$(($COUNTER + 1))
fi
done
I want to update global counter , but when I executed next query the COUNTER does not pick the previous value bcz of the “|” (pipe) .
How I can change the above code to work with named pipes or any other alternative .
Here is reference but I am new to bash and unable to understand if that is possible with mysql
My bash version says:
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Copyright (C) 2007 Free Software Foundation, Inc.
Use Process Substitution instead, as shown below: