ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [mdk-re] Сменаправ
@ 2001-06-04  8:28 Sergei
  2001-06-04 10:11 ` îÁ: [mdk-re] óÍÅÎÁÐÒÁ× Andrey Zolotnicky
  2001-06-05  7:26 ` [mdk-re] Re: [mdk-re] Сменаправ Alexey Voinov
  0 siblings, 2 replies; 4+ messages in thread
From: Sergei @ 2001-06-04  8:28 UTC (permalink / raw)
  To: mandrake-russian

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

Как-то пробегало сообщение о смене прав. Хочу предложить скрипт смены прав у 
файлов и каталогов рекурсивно и при этом различает права для каталогов и 
файлов.

-- 
С уважением, Епифанов Сергей

[-- Attachment #2: chsub --]
[-- Type: text/plain, Size: 1282 bytes --]

#!/bin/sh

if [ "$4" != "sub" ]
then
 if [ x"$4" != x ]
 then
	echo "ERROR: in parameters"
	exit 10
 fi
echo "(C) PIF 2000"
echo "Change permissions for subdirectories"
echo " "
fi

dirmode=$1
filemode=$2
dirpath=$3

if [ "$4" != "sub" ]
then
if [ x"$dirpath" == x ]
then
echo "This program will change access mode for directories and files recursively"
echo "Usage: chsub dirmode filemode dir"
echo "       dirmode  - directory mode"
echo "       filemode - file mode"
echo "       dir      - the name of the directory or file"
echo " "
echo "Example: chsub /tmp 755 644"
exit 0
fi
fi

if [ $# -le 2 ]
then
echo "ERROR: in parameters"
echo "Type chsub for help"
exit 1
fi

if [ -e "$dirpath" ]
then
 chmod $dirmode "$dirpath"
else
 echo "ERROR: $dirpath does not exists!"
 exit 11
fi

if [ $? -ne 0 ]
then
echo "ERROR: in chmod"
exit 2
fi
for i in `ls -1a "$dirpath"`
do
if [ "$i" != "." ]
then
#Skip file "."
 if [ "$i" != ".." ]
 then
#Skip file ".."
	if [ -d "$dirpath/$i" ]
	then
#If $dirpath/$i is a directory
	 echo "Directory $dirpath/$i"
	 chmod "$dirmode" "$dirpath/$i" >/dev/null 2>&1
	 $0 "$dirpath/$i" "$dirmode" "$filemode" sub
	else
#if $dirpath/$i is not a directory
	 echo "   File $dirpath/$i"
	 chmod "$filemode" "$dirpath/$i" >/dev/null 2>&1
	fi
		
 fi
fi

done

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-06-06  0:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-04  8:28 [mdk-re] Сменаправ Sergei
2001-06-04 10:11 ` îÁ: [mdk-re] óÍÅÎÁÐÒÁ× Andrey Zolotnicky
2001-06-06  0:42   ` [mdk-re] Re: На: [mdk-re]Сменаправ Sergei
2001-06-05  7:26 ` [mdk-re] Re: [mdk-re] Сменаправ Alexey Voinov

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git