From: "solsTiCe d'Hiver" <solstice.dhiver@gmail.com>
To: dash@vger.kernel.org
Subject: "if [ s1 > s2 ]" broken, writing a s2 file
Date: Mon, 8 Dec 2014 18:32:21 +0100 [thread overview]
Message-ID: <CAE4vF2dip455tXT4K3XwJy1Pp_qrw0fupd3xoAKUgbCG7vcFzg@mail.gmail.com> (raw)
hello,
folowing that bug
https://bugs.launchpad.net/ubuntu/+source/update-notifier/+bug/1400357,
I follow through to investigate and I found out
that whatever I try, when comparing 2 strings I always end up with a
file written to disk
From the man page
test expression
[ expression ]
[...]
s1 > s2 True if string s1 comes after s2 based on the ASCII
value of their characters.
when I try to use it:
a="ert"
b="aze"
if [ $a > $b ] ; then
echo yes
fi
if [ "aer" > "azer" ] ;then
echo yes
fi
I got 2 yes printed on screen whereas only one should and most
importantly I got 2 empty files written to disk: one called "aze", and
another one "azer"
so this "if syntax" is broken or I don't knwo how to use it.
Also it is really dangerous to use a syntax similar to file
redirection and this is exactly what is happening here.
this is happening with 0.5.8 too
next reply other threads:[~2014-12-08 17:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-08 17:32 solsTiCe d'Hiver [this message]
2014-12-08 17:39 ` "if [ s1 > s2 ]" broken, writing a s2 file Eric Blake
2014-12-08 17:46 ` solsTiCe d'Hiver
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=CAE4vF2dip455tXT4K3XwJy1Pp_qrw0fupd3xoAKUgbCG7vcFzg@mail.gmail.com \
--to=solstice.dhiver@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 read-only IMAP folder(s) and NNTP newsgroup(s).