Unix Shell - Checking if database exists on another server

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > May 2004 > Checking if database exists on another server





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Checking if database exists on another server
zanzan

2004-05-20, 5:37 pm

Hello,

I'm writing a little script and I would like to find out if a certain
database exists on a specific server.

I tried this but it did not work :

if [-x -h IpAdressOfOtherServer dbname ]; ...

Thank you for your help
Gen
Kevin Collins

2004-05-22, 10:28 pm

In article <4e657c51.0405200925.566d8ad2@posting.google.com>, zanzan wrote:
> Hello,
>
> I'm writing a little script and I would like to find out if a certain
> database exists on a specific server.
>
> I tried this but it did not work :
>
> if [-x -h IpAdressOfOtherServer dbname ]; ...


And how is that supposed to do what you want? Both -x and -h take arguments,
but need something to "AND" (-a or &&, depending on shell) the tests:

if [[ -x IpAdressOfOtherServer -a -h dbname ]; ...

or

if [[ -x IpAdressOfOtherServer && -h dbname ]]; ...

Additionally, yours tests make no sense: -x tests a file to see if it is
executable and -h checks to see if it is a symbolic link, so your test is
saying:

If the file "IpAdressOfOtherServer" is executable AND the file "dbname" is a
symbolic link, do something.

Kevin
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com