| 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
|