ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
* [sisyphus] баг в printf?
@ 2002-03-05  6:57 Eugeny Korekin
  2002-03-05  7:10 ` Dmitry V. Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Eugeny Korekin @ 2002-03-05  6:57 UTC (permalink / raw)
  To: sisyphus

Вот, наткнулся:
printf "%2$s %1$s" a b
printf: % : неверная директива

Когда-то работало.
Для проверки написал аналогичное на C:
main(){
     printf("%2$s %1$s","a","b");
}

работает.

~$ rpm -qf `which printf`
sh-utils-2.0.11-alt3

-- 
	Best regards, -- Eugeny.

Violence in reality is quite different from theory.
		-- Spock, "The Cloud Minders", stardate 5818.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sisyphus] баг в printf?
  2002-03-05  6:57 [sisyphus] баг в printf? Eugeny Korekin
@ 2002-03-05  7:10 ` Dmitry V. Levin
  2002-03-05  7:31   ` Eugeny Korekin
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry V. Levin @ 2002-03-05  7:10 UTC (permalink / raw)
  To: ALT Linux Sisyphus mailing list

[-- Attachment #1: Type: text/plain, Size: 605 bytes --]

On Tue, Mar 05, 2002 at 12:57:26PM +0600, Eugeny Korekin wrote:
> Вот, наткнулся:
> printf "%2$s %1$s" a b
> printf: % : неверная директива

Посмотрите на содержание "$s".

> Когда-то работало.

$s другим был, наверное. :)


Regards,
	Dmitry

+-------------------------------------------------------------------------+
Dmitry V. Levin     mailto://ldv@alt-linux.org
ALT Linux Team      http://www.altlinux.com/
Fandra Project      http://www.fandra.org/
+-------------------------------------------------------------------------+
UNIX is user friendly. It's just very selective about who its friends are.

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sisyphus] баг в printf?
  2002-03-05  7:10 ` Dmitry V. Levin
@ 2002-03-05  7:31   ` Eugeny Korekin
  0 siblings, 0 replies; 3+ messages in thread
From: Eugeny Korekin @ 2002-03-05  7:31 UTC (permalink / raw)
  To: ALT Linux Sisyphus mailing list

"Dmitry V. Levin" <ldv@alt-linux.org> writes:

>> printf "%2$s %1$s" a b
>> printf: % : неверная директива


> Посмотрите на содержание "$s".

Мда, ошибся с кавычками, когда письмо писал.
$s тут ни при чем.

~$ printf '%2\$s %1\$s' a b
printf: %$:неверная директива
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
вот так на самом деле ругается.

Из орейливских Unix power tools:
------------------------------------------
Another utility called printf works like the printf(3) routine in the
C language; it handles escape sequences, lets you set field widths,
and more. (The GNU version is on the CD-ROM.) Here's an example. The
wc command gives the number of lines, words, and characters in a file,
followed by the filename. We pass those four fields in the wc output
to the printf command line with backquotes (9.16). (If you need a
reminder of wc's output, see article 29.6.) printf takes a formatting
command from its first argument. It outputs the fourth argument after
that (%4$s, the filename); the number of words from the second
argument, in a field five wide with leading zeroes (%2$05s); and the
number of lines from the first argument (%1$s); with a newline (\n) to
finish the line:
$ printf 'The %4$s file has %2$05s words on %1$s lines.\n' `wc count`
The count file has 00235 words on 42 lines.
--------------------------------------------



-- 
	Best regards, -- Eugeny.

As of next Thursday, UNIX will be flushed in favor of TOPS-10.
Please update your programs.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-03-05  7:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-05  6:57 [sisyphus] баг в printf? Eugeny Korekin
2002-03-05  7:10 ` Dmitry V. Levin
2002-03-05  7:31   ` Eugeny Korekin

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