* [Comm] bash -- please help
@ 2004-09-30 9:03 Jury Levykin
2004-09-30 9:16 ` Alexey Morsov
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Jury Levykin @ 2004-09-30 9:03 UTC (permalink / raw)
To: community
Как на bash написать следующую операцию:
=================
summ=0
x1=2
x2=3
summ=$summ + $x1
summ=$summ + $x2
==================
пробую использовать "expr $summ + $x1"
но не получается результат записать в переменную.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] bash -- please help
2004-09-30 9:03 [Comm] bash -- please help Jury Levykin
@ 2004-09-30 9:16 ` Alexey Morsov
2004-09-30 9:22 ` Jury Levykin
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Alexey Morsov @ 2004-09-30 9:16 UTC (permalink / raw)
To: community
Jury Levykin wrote:
> Как на bash написать следующую операцию:
>
> =================
> summ=0
> x1=2
> x2=3
>
> summ=$summ + $x1
> summ=$summ + $x2
> ==================
>
> пробую использовать "expr $summ + $x1"
> но не получается результат записать в переменную.
по моему там надо перменные в [] брать чтобы он их как числа
считал (man bash)
--
Всего наилучшего,
Системный Администратор ЗАО "ИК "РИКОМ-ТРАСТ"
Алексей Морсов
ICQ: 196766290
Jabber: Samurai@jabber.ru
http://www.ricom.ru
http://www.fondmarket.ru
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] bash -- please help
2004-09-30 9:03 [Comm] bash -- please help Jury Levykin
2004-09-30 9:16 ` Alexey Morsov
@ 2004-09-30 9:22 ` Jury Levykin
2004-09-30 9:22 ` php-coder
2004-09-30 10:24 ` Maksim Otstavnov
3 siblings, 0 replies; 6+ messages in thread
From: Jury Levykin @ 2004-09-30 9:22 UTC (permalink / raw)
To: community
Jury Levykin пишет:
> Как на bash написать следующую операцию:
>
> =================
> summ=0
> x1=2
> x2=3
>
> summ=$summ + $x1
> summ=$summ + $x2
Нашел !
summ=`expr $summ + $x`
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] bash -- please help
2004-09-30 9:03 [Comm] bash -- please help Jury Levykin
2004-09-30 9:16 ` Alexey Morsov
2004-09-30 9:22 ` Jury Levykin
@ 2004-09-30 9:22 ` php-coder
2004-09-30 9:24 ` Jury Levykin
2004-09-30 10:24 ` Maksim Otstavnov
3 siblings, 1 reply; 6+ messages in thread
From: php-coder @ 2004-09-30 9:22 UTC (permalink / raw)
To: Jury Levykin
0000100101011110100100101::30.09.2004::0110001001001000100111100100010
Здравствуйте, Jury!
Отвечаю на Ваше письмо:
JL> summ=0
JL> x1=2
JL> x2=3
JL> summ=$summ + $x1
JL> summ=$summ + $x2
summ=$(($summ + $x1))
или
summ=$[$summ + $x1]
Так вроде...
--
С уважением, php-coder (mailto:php-coder[at]ngs[dot]ru)
Registered Linux User #327594
ALT Linux Master 2.2 (kernel 2.4.27)
010010010010010001010101100::Linux RuleZz!::100010010001000100010001110
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] bash -- please help
2004-09-30 9:22 ` php-coder
@ 2004-09-30 9:24 ` Jury Levykin
0 siblings, 0 replies; 6+ messages in thread
From: Jury Levykin @ 2004-09-30 9:24 UTC (permalink / raw)
To: community
php-coder пишет:
>0000100101011110100100101::30.09.2004::0110001001001000100111100100010
>
> summ=$(($summ + $x1))
>
> или
>
> summ=$[$summ + $x1]
>
Это тоже работает, спасибо.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] bash -- please help
2004-09-30 9:03 [Comm] bash -- please help Jury Levykin
` (2 preceding siblings ...)
2004-09-30 9:22 ` php-coder
@ 2004-09-30 10:24 ` Maksim Otstavnov
3 siblings, 0 replies; 6+ messages in thread
From: Maksim Otstavnov @ 2004-09-30 10:24 UTC (permalink / raw)
To: Jury Levykin
Hello Jury,
Thursday, September 30, 2004, 1:03:52 PM, you wrote:
JL> пробую использовать "expr $summ + $x1"
JL> но не получается результат записать в переменную.
Не "expr $summ + $x", а `expr $summ + $x`.
--
-- Maksim
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-09-30 10:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-30 9:03 [Comm] bash -- please help Jury Levykin
2004-09-30 9:16 ` Alexey Morsov
2004-09-30 9:22 ` Jury Levykin
2004-09-30 9:22 ` php-coder
2004-09-30 9:24 ` Jury Levykin
2004-09-30 10:24 ` Maksim Otstavnov
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