I know there is many similar questions but I was not able to find an answer for mine:
I have couple of if and checking to get to this point of source script to call another script
source ./call.sh
And in destination script I want to get user name from user:
#!/bin/bash passDir="/etc/passwd" while true do #propmt for username read -p "Enter username : " username egrep "^$username" $passDir >/dev/null if [ $? -eq 0 ]; then echo "$username exists!" else userName=$username break fi done
But it doesn't wait for me to enter anything. It goes inside a loop and print exist unless I press Ctrl+C I appreciate if anyone can give me suggestion how to do it. In my destination script I have dozen of other prompts to get input from the user When I run destination script alone it works fine.