User:Krikko

From ICO wiki
Revision as of 20:46, 10 May 2011 by 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 ]; …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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
	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