I have a custom script that checks some user information such as shell path, for example. I would like to add another statement to check if a user has a NIS Map, but I would like to write an "echo" command like "NO NIS MAP!" if it returns no value. Below is an example-
echo -e "NIS MAP"
ypcat -k auto.home.ndh | grep -i -w "$@"
I am expecting to write an if/else statement that will "echo" a statement if a NIS Map can't be located for a user.
You could try something like:
If
grepcan't find what it's looking for it should return 1.$?looks at the return value from the previous command.