ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Epiphanov Sergei <serpiph@nikiet.ru>
To: ALT Linux Sisyphus discussion list <sisyphus@lists.altlinux.org>
Subject: Re: [sisyphus] zsh/bash: различия работы let
Date: Thu, 19 Jul 2007 13:21:31 +0400
Message-ID: <200707191321.31896.serpiph@nikiet.ru> (raw)
In-Reply-To: <75e139a00707182328k6df9e613q49bbb2c892d4668@mail.gmail.com>

В сообщении от 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 сохраняется для каждого параметра независимо,

-- 
С уважением, Епифанов Сергей

      reply	other threads:[~2007-07-19  9:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19  6:28 Slava Semushin
2007-07-19  9:21 ` Epiphanov Sergei [this message]

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=200707191321.31896.serpiph@nikiet.ru \
    --to=serpiph@nikiet.ru \
    --cc=sisyphus@lists.altlinux.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

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