From: Denis Klimov <zver@distance.ru>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] [SCM] packages/avreg: heads/master
Date: Fri, 4 Jul 2008 15:30:26 +0600
Message-ID: <20080704153026.1aed2e2f.zver@distance.ru> (raw)
In-Reply-To: <75e139a00807032208k17a77352i842b1a6dc3ef4399@mail.gmail.com>
On Fri, 4 Jul 2008 12:08:34 +0700 Slava Semushin wrote:
> 2008/7/4 Denis Klimov <zver / altlinux.org>:
> > Update of /people/zver/packages/avreg.git
> [...]
> > +++ b/common/create_db
> > @@ -100,7 +100,10 @@ feel_db() {
> > echo "Database $AVREGDB already exist"
> > fi
> > }
> > -
> > +if [ $USER != 'root' ]; then
> > + echo 'This script must be run by root'
> > + exit 1
> > +fi
> >
> > if [ -r $MYSQL_CNF ]; then
> > chmod 0600 $MYSQL_CNF
>
> Предлагаю хотя бы стремиться писАть более-менее стабильный код,
> который был бы устойчив к пробелам в именах файлах и пустым
> значениям... Этот код никуда не годится, вот так лучше, на мой взгляд:
>
> if [ "$USER" != 'root' ]; then
> echo 'This script must be run by root' >&2
> exit 1
> fi
>
> И далее везде -- заключайте переменные в двойные кавычки, особенно в
> условиях if, ведь если переменная окажется пустой, то условие будет
> некорректным и вы получите синтаксическую ошибку.
>
Благодарю за советы и внимание. В программировании на shell я пока новичок.
--
Denis Klimov
zver
next prev parent reply other threads:[~2008-07-04 9:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-04 5:08 ` Slava Semushin
2008-07-04 9:30 ` Denis Klimov [this message]
2008-07-05 21:13 ` [devel] [JT] shell scripting Michael Shigorin
2008-07-05 21:19 ` Slava Semushin
2008-07-19 11:49 ` Stanislav Ievlev
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=20080704153026.1aed2e2f.zver@distance.ru \
--to=zver@distance.ru \
--cc=devel@lists.altlinux.org \
/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 Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/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 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git