User:Krikko

From ICO wiki
Revision as of 13:45, 12 May 2011 by Krikko (talk | contribs)
Jump to navigationJump to search
#faili olemasolu
if [ -e "$1" ];
then
	#faili õigused numbrilisel kujul
	oigused=$(stat -c %a $1)
	#faili ja sisendi õigused samad
	if [ $oigused = $2 ];
	then
	exit 0
	fi
	#õigustest substring ja nende võrdlemine
	if [ ! $(expr substr $2 1 1) = $(expr substr $oigused 1 1) ] 
	then	
	exit 2
	fi
	if [ ! $(expr substr $2 2 1) = $(expr substr $oigused 2 1) ] 
	then	
	exit 3
	fi
	if [ ! $(expr substr $2 3 1) = $(expr substr $oigused 3 1) ] 
	then	
	exit 4
	fi
#faili ei leitud
else
exit 1
fi