I’m writing a shell script using Bourne shell (sh) to connect to sybase and execute some system procedures based on the data given by the user.
However, i want my script to first check if the login id specified by the user exists before i start executing other system procedures to edit or remove some of the user’s details.
I want my script to do the following, after connecting to sybase.
1. Execute a system procedure “sp_displaylogin” to check if the user’s login exists.
If it exists, then i have to redirect it to a function that performs the rest of the execution.
2. If the login does not exist, then i have to execute a system procedure “sp_addlogin” to create the login.
Now comes the big problem.
I want to know how i can read the results of “sp_displaylogin” so that i can determine if the login id exists or not, and redirect my execution acordingly.
How do i do it?