#!/bin/sh 
# vim:tabstop=2:softtabstop=0:shiftwidth=2
#=============================================================================|
#                *** PROPRIETARY RIGHTS NOTICE ***                            |
#   This material contains proprietary information of MULI Holdings P/L,      |
#   Wahroonga, NSW, Australia and/or its licensor, embodying                  |
#   "CONFIDENTIAL INFORMATION" ideas and expressions, no part of which may    |
#   be reproduced or transmitted without permission of MULI Management P/L.   |
#      ***  COPYRIGHT  1982 - 2013  ***  MULI Holdings P/L  ***               |
#                          All rights reserved.                               |
#=============================================================================|

# This script relies on there being an unpassworded ssh-key enabling 
# remote access to the target server 'mulihost'

# It is an analogue of the 'test' bash builtin command alias `['

TARGET=mulihost

if [ $# -ne 2 ]; then
  echo "Usage: if (./rtest TESTTYPE FILE_PATH) then echo \"yes\"; else echo \"no\"; fi"
  echo "EG: if (./rtest -d /tmp) then echo \"yes\"; else echo \"no\"; fi"
  echo "See 'man test' for further information."
  exit 2
fi

RES=`ssh $TARGET "if [ $1 $2 ]; then echo true; else echo false; fi"`
if [ "$RES" = "true" ]; then
	exit 0
else
	exit 1
fi
