From: Andrey Voropaev <voropaev.andrey@gmail.com>
To: dash@vger.kernel.org
Subject: Tests [ 0 -eq $UID ] don't work as in bash
Date: Wed, 7 Sep 2016 16:44:03 +0200 [thread overview]
Message-ID: <CAFOXTdceLsR_xBcs=B2QajQHW_UJyBKTr6R8fQvUNCxikYn77w@mail.gmail.com> (raw)
Hello!
I'm sorry if this is FAQ question, but googling didn't report it, so
I'm asking here.
In our scripts we often use constructs like
##############
if [ 0 -eq $UID ]
then
echo "This script must not be run by root user!"
exit 1
fi
#################
This works fine in bash, but dash fails with warning " [: -ne:
argument expected". Is this intended feature? How to work around it in
dash then?
Best regards
Andrei Voropaev
next reply other threads:[~2016-09-07 14:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 14:44 Andrey Voropaev [this message]
2016-09-07 15:55 ` Tests [ 0 -eq $UID ] don't work as in bash Paul Smith
2016-09-07 20:02 ` Stephane Chazelas
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='CAFOXTdceLsR_xBcs=B2QajQHW_UJyBKTr6R8fQvUNCxikYn77w@mail.gmail.com' \
--to=voropaev.andrey@gmail.com \
--cc=dash@vger.kernel.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).