Skip to main content
deleted 15 characters in body
Source Link
Jim L.
  • 8.8k
  • 1
  • 15
  • 29

This is untested, but what if you tweaked your code to be something like this?

function pc () { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } function one() { pc << EOF SEL 1; EOF } function two() { while IFS= read -r line do three "$line" done < file } function three() {  if [ "$1" = Y ]  then   pc << EOF Update table; EOF  fi } # main function one two < file 

This is untested, but what if you tweaked your code to be something like this?

function pc { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } function one { pc << EOF SEL 1; EOF } function two { while IFS= read -r line do three "$line" done < file } function three { if [ "$1" = Y ] then pc << EOF Update table; EOF fi } # main function one two 

This is untested, but what if you tweaked your code to be something like this?

pc() { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } one() { pc << EOF SEL 1; EOF } two() { while IFS= read -r line do three "$line" done } three() {  if [ "$1" = Y ]  then   pc << EOF Update table; EOF  fi } # main function one two < file 
Double-quote variables when you use them
Source Link
Chris Davies
  • 128.3k
  • 16
  • 179
  • 324

This is untested, but what if you tweaked your code to be something like this?

function pc { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } function one { pc << EOF SEL 1; EOF } function two { while IFS= read -r line do three $line"$line" done < file } function three { if [ $1"$1" === Y ] then pc << EOF Update table; EOF fi } # main function one two 

This is untested, but what if you tweaked your code to be something like this?

function pc { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } function one { pc << EOF SEL 1; EOF } function two { while IFS= read -r line do three $line done < file } function three { if [ $1 == Y ] then pc << EOF Update table; EOF fi } # main function one two 

This is untested, but what if you tweaked your code to be something like this?

function pc { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } function one { pc << EOF SEL 1; EOF } function two { while IFS= read -r line do three "$line" done < file } function three { if [ "$1" = Y ] then pc << EOF Update table; EOF fi } # main function one two 
Source Link
Jim L.
  • 8.8k
  • 1
  • 15
  • 29

This is untested, but what if you tweaked your code to be something like this?

function pc { /usr/bin/psql --host=abx --port=1234 --dbname=A --username=user } function one { pc << EOF SEL 1; EOF } function two { while IFS= read -r line do three $line done < file } function three { if [ $1 == Y ] then pc << EOF Update table; EOF fi } # main function one two