tags:

views:

32

answers:

1
HOSTNAME=$1

#missing files will be created by chk_dir
for i in `cat filesordirectorieslist_of_remoteserver`
do

isdir=remsh $HOSTNAME "if [ -d $i ]; then echo dir; else echo file; fi"

if [ $isdir -eq "dir" ]
then

remsh $HOSTNAME "ls -d $i | cpio -o" | cpio -id
else

remsh $HOSTNAME "ls | cpio -o" | cpio -id
fi
done

i need simple solution for checking remote file is directory or file ? thanks

A: 

You need to add backticks around the first remsh:

isdir=`remsh $HOSTNAME "if [ -d $i ]; then echo dir; else echo file; fi"`
psmears