Hi all,
Something funny happen with this code:
EXIST=`ssh batch@190.2.332.234 'if [ -f $remotePath/$fileName ]; then echo 0; else echo 1 ; fi'`
echo $EXIST
Above code will display "1".
The value of remotePath is /home/batch
The value of fileName is sample.txt
EXIST=`ssh batch@190.2.332.234 'if [ -f /home/batch/sample.txt ]; then echo 0; else echo 1 ; fi'`
echo $EXIST
Above code will display "0".
The correct result should be "0". But I dont know how come those two codes produce different result. Anybody know?
Thanks
---------- Post updated at 04:45 AM ---------- Previous update was at 04:41 AM ----------
Solved... i changed the "-f" to "-e". I dont why it works that way..