I have the following script which is to compare two directories using the sdiff command
The output files were created from local and remote servers, I need to put the differences into another file and email the differences how will I do that?
I would also like to cut from the files created the permissions etc, how can i do that?
herewith output file
Code:
#!/bin/ksh
LOCALFOLDER=/u1/mac2
REMOTEFOLDER=$(rsh sun5 'ls -lA /u1/mac2' > remotessh.txt)
COMMAND=$(ls -lA $LOCALFOLDER > localssh.txt)
REM=$(cat remotessh.txt)
LOCAL=$(cat localssh.txt)
echo $LOCAL
echo $REM
if [ $REM -eq $LOCAL ]
then
echo Directories are the same
else
echo Directories are differnt
fi
#sdiff localssh.txt remotessh.txt | grep '\|'
The output files were created from local and remote servers, I need to put the differences into another file and email the differences how will I do that?
I would also like to cut from the files created the permissions etc, how can i do that?
herewith output file
Code:
drwxrwxr-x 3 mac2 querix 3 Nov 30 00:00 .sunstudio
drwx------ 3 mac2 querix 3 Nov 30 00:00 .sunw
drwxr-xr-x 3 mac2 querix 3 Nov 30 00:00 .vim
-rw-rw-r-- 1 mac2 querix 6197 Nov 30 00:00 .viminfo
-rw-rw-r-- 1 mac2 querix 102 Nov 30 00:00 .vimrc
-rw------- 1 mac2 querix 200 Nov 30 00:00 .Xauthority
-rwxrwxr-x 1 mac2 querix 46352 Nov 30 00:00 a_calc00.4ge
-rw-rw-r-- 1 mac2 querix 11902 Nov 30 00:00 a_calc00.4gl
-rw-rw-r-- 1 mac2 querix 60 Nov 30 00:00 a_calc00.def
-rw-rw-r-- 1 mac2 querix 1527 Nov 30 00:00 a_calc01.per
-rw-rw-r-- 1 mac2 querix 1464 Nov 30 00:00 a_calc01.pic
-rwxrwxr-x 1 mac2 querix 66208 Nov 30 00:00 a_ecb000.4ge
-rw-rw-r-- 1 mac2 querix 24895 Nov 30 00:00 a_ecb000.4gl
-rw-rw-r-- 1 mac2 querix 112 Nov 30 00:00 a_ecb000.def
-rw-rw-r-- 1 mac2 querix 444 Nov 30 00:00 a_ecb000.per
-rw-rw-r-- 1 mac2 querix 322 Nov 30 00:00 a_ecb000.pic
-rw-rw-r-- 1 mac2 querix 1929 Nov 30 00:00 a_ecb001.per
-rw-rw-r-- 1 mac2 querix 2357 Nov 30 00:00 a_ecb001.pic