From: "Аркадий Павлик" <pvl@pskb.com>
To: community@altlinux.ru
Subject: [Comm] сравнение строк в bash'e
Date: Mon, 7 Apr 2003 17:40:23 +1100
Message-ID: <200304071740.23492.pvl@pskb.com> (raw)
Понадобилось тут пару строк в баше сравнить...
Взял евойное хау-ту, которых в инете пруд пруди, но все как один твердят одно
и тоже. В лоб скопировал пример оттуда (11.2), ну тот где:
#!/bin/bash
S1='string'
S2='String'
if [ $S1=$S2 ];
then
echo "S1('$S1') не равна to S2('$S2')"
fi
if [ $S1=$S1 ];
then
echo "S1('$S1') равна to S1('$S1')"
fi
Выполнил. Скрипт мне весело сообщил:
S1('string') не равна to S2('String')
S1('string') равна to S1('string')
Вроде всё правильно. Но вот одно "НО" меня тревожит!
В первом if используется оператор РАВЕНСТВА!!!
Попробовал заменить = на != результат монопенисуальный.
S1('string') не равна to S2('String')
S1('string') равна to S1('string')
Где я чего пропустил?
Хотя, больше инетересует вопрос, как же эти клятые строки сравнивать? :)
--
С наилучшими пожеланиями,
Аркадий Павлик
next reply other threads:[~2003-04-07 6:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-07 6:40 Аркадий Павлик [this message]
2003-04-07 7:02 ` Yura Kalinichenko
2003-04-07 9:39 ` Аркадий Павлик
2003-04-07 10:29 ` Yura Kalinichenko
2003-04-07 7:30 ` Vitaly Lipatov
2003-04-07 9:37 ` Аркадий Павлик
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=200304071740.23492.pvl@pskb.com \
--to=pvl@pskb.com \
--cc=community@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