Wild, I get syntax error: unexpected end of file
when I run your code, so just that alone is very confusing.
When you're inside foo
here, STDIN is the pipe. Once I fix this syntax error that you somehow dodge and add some extra debugging, you can get a better picture of what's going on here:
foo() {
read -r -p "delete $name (default is no) [y/n]? " choice
choice="${choice:-n}"
echo "\$choice: $choice"
}
printf "%s\n" "foo" "bar" "baz" "eggs" "spam" | while read -r name; do
printf "Got name '%s'\n" "$name"
echo calling foo
foo
done
Got name 'foo'
calling foo
$choice: bar
Got name 'baz'
calling foo
$choice: eggs
Got name 'spam'
calling foo
$choice: n
For a while now I've been using either haproxy or nginx depending on my needs. I've hit instances with both where the functionality I want is in the paid version.