#!/bin/sh
CONFIG_DIR="/var/opt/SUNWldm/"
read option
if [ $option -eq 9 ]; then
ret=1
elif [ -e ${CONFIG_DIR}file.xml.${option} ]; then
echo "TRUE"
fi
I have the above code in a while loop to present a list of options. Unfortunately I'm having problems with the elfi statement.
From: IF for Beginners the -e returns true if the file exists.
I've double checked the syntax and even running the script in debug mode (I put set -x at the beginning of this script and could see that the replacement in the if is done properly as seen inline:
+ [ 201301271355 -eq 9 ]
+ [ -e /var/opt/SUNWldm/file.xml.201301271355 ]
./ldm_recover.sh: test: argument expected
I've been searching so far and haven't found a reason for failing, any ideas what I'm doing wrong?