View previous topic :: View next topic |
Author |
Message |
shabbychef n00b

Joined: 08 Jun 2005 Posts: 43
|
Posted: Wed Apr 23, 2008 8:52 pm Post subject: coreutils seq not as advertised? [SOLVED] |
|
|
I have sys-apps/coreutils-6.9-r1 installed (and sys-apps/man-pages-2.78, app-shells/bash-3.2_p17-r1). my seq (in coreutils) seems borked. For example, the info page for seq says:
Quote: |
...snip...
You can get finer-grained control over output with `-f':
$ seq -f '(%9.2E)' -9e5 1.1e6 1.3e6
(-9.00E+05)
( 2.00E+05)
( 1.30E+06)
If you want hexadecimal integer output, you can use `printf' to
perform the conversion:
$ printf '%x\n' `seq 1048575 1024 1050623`
fffff
1003ff
1007ff
...snip..
|
But when I try these in my shell, I get:
Quote: |
$ seq -f '(%9.2E)' -9e5 1.1e6 1.3e6
bash: [: -f: integer expression expected
bash: [: -f: integer expression expected
-f
$ printf '%x\n' `seq 1048575 1024 1050623`
0
|
In fact, my seq does not seem to do anything useful, and is rather bizarre:
Quote: |
$ seq 3
bash: [: 3: unary operator expected
bash: [: 3: unary operator expected
3
$ seq 1 3
1 2 3 4
$ seq 1 3 999999
1 2 3 4
|
for what its worth, I looked at some things:
Quote: |
$ file `which seq`
/usr/bin/seq: symbolic link to `/bin/seq'
$ file /bin/seq
bin/seq: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), stripped
$ equery b /bin/seq
[ Searching for file(s) /bin/seq in *... ]
sys-apps/coreutils-6.9-r1 (/bin/seq)
|
I am going to try to re-emerge coreutils, but am not sure what's going on here. the seq I have does nothing like what I would expect, or is the info page stale? It seems like bash is interpreting 'seq' to mean something other than /usr/bin/seq? _________________ shabby
Last edited by shabbychef on Wed Apr 23, 2008 9:10 pm; edited 1 time in total |
|
Back to top |
|
 |
yabbadabbadont Advocate


Joined: 14 Mar 2003 Posts: 4791 Location: 2 exits past crazy
|
Posted: Wed Apr 23, 2008 8:59 pm Post subject: |
|
|
I think that bash has a built-in "seq" command. You need to either use the full path to the one from coreutils, or preface your command with '\'.
Try these and see if they work:
Code: | \seq -f '(%9.2E)' -9e5 1.1e6 1.3e6 |
and
Code: | /bin/seq -f '(%9.2E)' -9e5 1.1e6 1.3e6 |
|
|
Back to top |
|
 |
shabbychef n00b

Joined: 08 Jun 2005 Posts: 43
|
Posted: Wed Apr 23, 2008 9:10 pm Post subject: [solved] |
|
|
yabbadabbadont wrote: | I think that bash has a built-in "seq" command. You need to either use the full path to the one from coreutils, or preface your command with '\'.
Try these and see if they work:
Code: | \seq -f '(%9.2E)' -9e5 1.1e6 1.3e6 |
and
Code: | /bin/seq -f '(%9.2E)' -9e5 1.1e6 1.3e6 |
|
yay. that worked! Nowhere, however, can I figure out what bash's builtin seq does, though... _________________ shabby |
|
Back to top |
|
 |
eccerr0r Watchman

Joined: 01 Jul 2004 Posts: 9932 Location: almost Mile High in the USA
|
Posted: Fri Apr 25, 2008 12:27 am Post subject: |
|
|
Might want to try
to see what default seq you're running...
Maybe you have some script 'seq' somewhere? or an alias/function? Not sure if bash is supposed to have a 'seq' ...
[ This thread should be in 'other,' not 'kernel&hardware'? ] _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
 |
shabbychef n00b

Joined: 08 Jun 2005 Posts: 43
|
Posted: Fri Apr 25, 2008 6:38 pm Post subject: |
|
|
eccerr0r wrote: | Might want to try
to see what default seq you're running...
Maybe you have some script 'seq' somewhere? or an alias/function? Not sure if bash is supposed to have a 'seq' ...
|
did the following:
Code: |
$ type -a seq
seq is a function
seq ()
{
local lower upper output;
lower=$1 upper=$2;
if [ $lower -ge $upper ]; then
return;
fi;
while [ $lower -le $upper ]; do
echo -n "$lower ";
lower=$(($lower + 1));
done;
echo "$lower"
}
seq is /usr/bin/seq
seq is /bin/seq
|
not sure where that function is defined, though. the info for type does not help me figure out how to find the seq function. I am assuming it is 'builtin'.
Quote: |
[ This thread should be in 'other,' not 'kernel&hardware'? ] |
yah, sorry. wasn't sure where to put it. _________________ shabby |
|
Back to top |
|
 |
eccerr0r Watchman

Joined: 01 Jul 2004 Posts: 9932 Location: almost Mile High in the USA
|
Posted: Fri Apr 25, 2008 8:49 pm Post subject: |
|
|
Looks like one of your login scripts is setting up a function that does something similar to coreutils seq, totally written as a script. Unfortunately bash doesn't support floats... _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
 |
|