Computing Staff
  • 0

Shell Script To Execute Sybase System Procedures

  • 0

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?

Please help.


1 Answer

  1. Most databases have a utility to access the database: oracle uses sqlplus and sybase uses isql.

    I am not a sybase user, but this article from the defunct Sys Admin magazine might give you some ideas how to access the database:…

    Also, I recently answered a question about trapping the output from an oracle script:…

    You might be able to modify it to access sybase.

    • 0