On Oct 23, 2017, at 08:37, 
pgsql-general-ow...@postgresql.org<mailto:pgsql-general-ow...@postgresql.org> 
wrote:

psql ..... | while read a; do
#    some code
done

The only problem I find with this is that you can't pass variables out
of the while loop,

To get input from a file w/o a sub-shell,
you can put the input at the end of the loop:

====
#!/bin/sh

cat > file <<EOF
ab
cd
ef
EOF
while read a; do
    b="$b $a"
    echo $b
done < file
====
-Randy

Reply via email to