below you will find a simple code. i am calling function input if the read input is Y however read command in input function never executes.
#!/bin/bash
input() {
read -p "Press any key to continue..." # read input (this part never executed)
}
mg() # prompt user for y=true, n=false
{
[ $FORCE ] && echo>&2 "$* (forced)" && return
while read<&2 -p "$* (Y/N)? [Y] " YN
do
[ -z "$YN" -o "$YN" = Y ] && return
[ "$YN" = N ] && return 1
done
err "failed to read from YN $*"
}
if mg "Enter Input?"
then in="yes" | input # call function input if mg return Y
else in="no"
fi
|in if?