Re: Checking if database exists on another server

From: Kevin Collins (spamtotrash_at_toomuchfiction.com)
Date: 05/21/04


Date: Fri, 21 May 2004 16:17:04 GMT

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



Relevant Pages

  • Get IP Address and MAC Address via script
    ... I am currently writing a domain migration script to join workstations ... Two of the columns in the database are for IP Address and ... multiple adapters with an IP Address or a single adapter with multiple ...
    (microsoft.public.scripting.vbscript)
  • Re: Help with Date
    ... > Im writing a script that will get the last 7 days of information, ... What database are you using? ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Decoding the query string array
    ... First off - you ought to becareful writing $_POST data to the database ... I'm new to MySQL but I have written a script that takes my HTML field/box ...
    (comp.lang.php)
  • Active Record Inheritance with out using type_id
    ... I am writing a script that queries a database for records with either ...
    (comp.lang.ruby)
  • Re: eval() or call_user_func() ???
    ... script (not a string). ... I am writing a simplified 'clone' of crontab, ... tasks - the tasks vbeing stored in a database table - I'm not ...
    (comp.lang.php)