* [sisyphus] zsh/bash: различия работы let
@ 2007-07-19 6:28 Slava Semushin
2007-07-19 9:21 ` Epiphanov Sergei
0 siblings, 1 reply; 2+ messages in thread
From: Slava Semushin @ 2007-07-19 6:28 UTC (permalink / raw)
To: ALT Linux Sisyphus discussion list
Здравствуйте!
Читал статью
http://www.ibm.com/developerworks/ru/library/l-bash-test/index.html и
обнаружил, что с помощью let можно получить десятичное значение числа,
заданного в восьмеричной форме. Вот только в zsh это не работает.
Может баг?
[c0der@rock ~]$ /bin/bash -c 'let x="015"; echo $x'
13
[c0der@rock ~]$ /bin/zsh -c 'let x="015"; echo $x'
15
C шестнадцатеричными значениями тоже работает иначе:
[c0der@rock ~]$ /bin/bash -c 'let x="0xff"; echo $x'
255
[c0der@rock ~]$ /bin/zsh -c 'let x="0xff"; echo $x'
16#FF
--
+ Slava Semushin | slava.semushin @ gmail.com
+ ALT Linux Team | php-coder @ altlinux.ru
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sisyphus] zsh/bash: различия работы let
2007-07-19 6:28 [sisyphus] zsh/bash: различия работы let Slava Semushin
@ 2007-07-19 9:21 ` Epiphanov Sergei
0 siblings, 0 replies; 2+ messages in thread
From: Epiphanov Sergei @ 2007-07-19 9:21 UTC (permalink / raw)
To: ALT Linux Sisyphus discussion list
В сообщении от Thursday 19 July 2007 10:28:03 Slava Semushin написал(а):
> Здравствуйте!
>
> Читал статью
> http://www.ibm.com/developerworks/ru/library/l-bash-test/index.html и
> обнаружил, что с помощью let можно получить десятичное значение числа,
> заданного в восьмеричной форме. Вот только в zsh это не работает.
> Может баг?
сейчас прочитал man zshmisc по арифметическим вычислениям, такая работа
вычислителя и подразумевается:
> [c0der@rock ~]$ /bin/bash -c 'let x="015"; echo $x'
> 13
> [c0der@rock ~]$ /bin/zsh -c 'let x="015"; echo $x'
> 15
Зато работает так:
$ /bin/zsh -c 'let "x=[#10]8#15"; echo $x'
13
$
> C шестнадцатеричными значениями тоже работает иначе:
>
> [c0der@rock ~]$ /bin/bash -c 'let x="0xff"; echo $x'
> 255
> [c0der@rock ~]$ /bin/zsh -c 'let x="0xff"; echo $x'
> 16#FF
Аналогично:
$ /bin/zsh -c 'let "x=[#10]0xff"; echo $x'
255
$
Основа счисления в zsh сохраняется для каждого параметра независимо,
--
С уважением, Епифанов Сергей
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-19 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-19 6:28 [sisyphus] zsh/bash: различия работы let Slava Semushin
2007-07-19 9:21 ` Epiphanov Sergei
ALT Linux Sisyphus discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/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 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
public-inbox-index sisyphus
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sisyphus
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git