I'm calling bash A via different user within bash B like this, and i want to stuck on line "*" untill user enters "exit".
# bash B
su test<<endOfTestOperation
./bashA.sh
endOfTestOperation
# bash A
# Start a process &
read LINE <------ I want to wait here until user inputs "exit"
if [ "$LINE" == "exit" ]; then
# end the process
exit
fi
If i call bash A only, it works fine. if i put "read" after "endOfTestOperation", it also works. So i guess the problem roots in using different permission or forked process.
[supplemental description] What i'm trying to do is: start a tcpdump (root permission required, so bash b is ran with sudo), then start a tcpserver progress, then end the tcpserver on demanding of user input in stdin.