User:Krikko: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Krikko (talk | contribs)
Created page with '<source lang="bash"> #faili olemasolu if [ -e "$1" ]; then #faili õigused numbrilisel kujul oigused=$(stat -c %a $1) #faili ja sisendi õigused samad if [ $oigused = $2 ]; …'
 
Krikko (talk | contribs)
No edit summary
Line 26: Line 26:
else
else
echo 1
echo 1
fi
</source>
</source>

Revision as of 20:47, 10 May 2011

#faili olemasolu
if [ -e "$1" ];
then
	#faili õigused numbrilisel kujul
	oigused=$(stat -c %a $1)
	#faili ja sisendi õigused samad
	if [ $oigused = $2 ];
	then
	echo 0
	fi
	#õigustest substring ja nende võrdlemine
	if [ ! $(expr substr $2 1 1) = $(expr substr $oigused 1 1) ] 
	then	
	echo 2
	fi
	if [ ! $(expr substr $2 2 1) = $(expr substr $oigused 2 1) ] 
	then	
	echo 3
	fi
	if [ ! $(expr substr $2 3 1) = $(expr substr $oigused 3 1) ] 
	then	
	echo 4
	fi
#faili ei leitud
else
echo 1
fi