From: Sergei <serpiph@pochtamt.ru>
To: mandrake-russian@altlinux.ru
Subject: [mdk-re] Сменаправ
Date: Mon Jun 4 08:28:01 2001
Message-ID: <01060408441100.13885@pif.b5.mephi.ru> (raw)
[-- 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
next reply other threads:[~2001-06-04 8:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-04 8:28 Sergei [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01060408441100.13885@pif.b5.mephi.ru \
--to=serpiph@pochtamt.ru \
--cc=mandrake-russian@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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