How do I format the 2 conditions below into one while loop which should ensure that data enter contains at least one alphabetical character and doesn't already exist in the directory /dev/null.
1
#name = "test123"
read -p "Enter you name: " name
until [[ "$name" =~ [A-Za-z] ]]; do
read -p "Please enter a valid name: " name
done
2
while id -u $name 2>/dev/null>1 ; do # Checks if username already exists
read -p "Please enter valid input: "
I know there are different ways toformat the 2 arguments in the while loop as it depends on the 2 arguments however i am not sure.
I've found this source below which i could proceed to trial an error however I want to know why I choosing to format the condition in such a way.