bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in seq?


From: Eric Blake
Subject: Re: bug in seq?
Date: Tue, 20 Mar 2007 20:18:11 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Thomas Graf on 3/20/2007 7:00 PM:
> description: seperator string with null bytes gives different outputs
> 
> $ seq -s"" 1 5
> 112131415
> $ seq -s "" 1 5
> 12345
> 
> it looks strang for me.

Cockpit error.  The argument for -s is mandatory, but by shell parsing
rules, you have just invoked "seq" "-s" "1" "5".  Therefore, "1" is the
argument to -s, and given only one argument to seq, as if you had done
'seq --separator=1 -- 5'.  Therefore, seq did what you asked, and printed
from 1 through 5 (it defaults to starting at 1 when there is only one
argument instead of two), with each digit also separated by the string "1".

If you actually want a NUL byte as the separator in the output, you will
have to do something like:

$ printf '%s\0' `seq 1 5`

since seq has no notion of understanding escape sequences, and since there
is no way to pass NUL to an application from the command line without the
use of escape sequences.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGAJXj84KuGfSFAYARAiAJAJ0dadSV8okxmmDJ55oNCCNjJtGZ9QCg0YcI
ZhNvKDNi3TFtfQ7kFr2qgMc=
=/XRu
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]