Hi,
Problem one:
Code:
#!/bin/ksh
# change these to your liking
FILE01="/path/to/file"
FILE02="/other/path/to/file"
FILE03="/another/path/to/file"
FILE01_TS="`ls -l --time-style=+%Y%m%d%H%M ${FILE01} | cut -d" " -f7`"
FILE02_TS="`ls -l --time-style=+%Y%m%d%H%M ${FILE02} | cut -d" " -f7`"
FILE03_TS="`ls -l --time-style=+%Y%m%d%H%M ${FILE03} | cut -d" " -f7`"
NEWEST_FILE="${FILE01}"
NEWEST_TS="${FILE01_TS}"
if (( FILE01_TS < FILE02_TS ))
then
NEWEST_TS="${FILE02_TS}"
NEWEST_FILE="${FILE02}"
fi
if (( NEWEST_TS < FILE03_TS ))
then
NEWEST_TS="${FILE03_TS}"
NEWEST_FILE="${FILE03}"
fi
echo ${NEWEST_FILE}
Maybe not to elegant, but it works.
Problem 2:
Can't you use ping (ping -c 1 <machine>) to check this?
Hope this gets you going again.