[SOLVED] time command gives error for SBU in Binutils
Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Distribution: O.A.M. (Overmonitoring Address Matrix) Release 2.2 with 2120 Patch
Posts: 37
Rep:
time command gives error for SBU in Binutils
Code:
$ time { ../binutils-2.20/configure --target=$LFS_TGT --prefix=/tools --disable-nls --disable-werror && make && make install; }
bash: syntax error near unexpected token `}'
$ time -V
GNU time 1.7
$ type time
time is /usr/bin/time
I'm reading LFS Stable 6.6. Maybe the time command
method in the Binutils section needs to be updated.
I'm using PCLinuxOS 2010.07.
There are 2 versions of the time command and they work differently:
1) A bash internal, which is used in the LFS example ($ type time -> time is a shell keyword)
2) An external time command, which you seem to use ($ type time -> time is /usr/bin/time)
The order in which bash looks for them: first the internal command, if not present the external one.
I find it a bit curious that you do not have the internal bash time command. Looks like PCLinuxOS 2010.07 is different that way.
Distribution: O.A.M. (Overmonitoring Address Matrix) Release 2.2 with 2120 Patch
Posts: 37
Original Poster
Rep:
I've since discovered:
PCLinuxOS 2010.07 does meet the host system requirements.
However, the time command shown in the LFS book is the bash
builtin command, not /usr/bin/time.
So, if your bash doesn't have time built into it, then the SBU value's command will fail.
I think the book should be updated to warn users of this possibility.
I'm guessing that most distros have a bash with time built into it.
PCLinuxOS 2010.07 isn't one of them:
Code:
$ builtin time
bash: builtin: time: not a shell builtin
EDIT:
Things have changed: I downloaded and burned lfslivecd-x86-6.3-r2160.iso.
I booted into it and got:
Code:
# which time
which: no time in (/bin:/usr/bin:/sbin:/usr/sbin)
# builtin time
-bash: builtin: time: not a shell builtin
# type cd
cd is a shell builtin
# type time
time is a shell keyword
Talk about complicated and confusing!
So I guess that time can either be
a system file
a shell builtin
a shell keyword
Last edited by na5m; 08-01-2010 at 02:31 PM.
Reason: New discovery
So I guess that time can either be
a system file a shell builtin
a shell keyword
Time is, when it comes down to it a builtin, but...... The time command is listed in the official Bash documentation as a keyword ("reserved word") and will show up as such.
The time command can be an executable (/usr/bin/time) and/or a bash keyword.
BTW: Time is one of the bash defaults, if you compile it normally it will be included. So I guess that PCLinuxOS should mention this (and other?) exclusion, it would be undoable for LFS to mention all the exceptions to the defaults other distro's created (be it for good or bad).
In general these external commands (time being one, pwd being another) are there for specific reasons. They work slightly different or have some other features. You also need to call them explicitly:
pwd for normal use (the bash keyword that is),
/bin/pwd to use the external executable.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.