LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-24-2007, 02:37 PM   #1
WingnutOne
Member
 
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76

Rep: Reputation: 16
Question time command problems?


I'm running a BASH shell in RHE4 and can't get any of the time command's arguments (the man page calls them "options") to work. All of the options that I've tried giving it (except -p), however, are being treated by BASH as separate commands.
Example:
Code:
 time -o filename date
generates the error message:
Code:
 -bash: -o: command not found
The same thing happens with the long version:
Code:
 time --output filename date
Per the man page, I'm using the right syntax.
time, without any options, runs just fine.

Has anyone else experienced similar problems? Am I misreading how it's supposed to work?

If it really is goofed up, is there another way to redirect the output? (It normally goes to standard error.)

Thanks!
 
Old 09-24-2007, 02:58 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 67
Try using the full path of the command:
Code:
/usr/bin/time
"time" may be an internal command in your shell, a function or an alias.
 
Old 09-24-2007, 03:09 PM   #3
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Very weird, I'm facing the same problem too. It works if I put a leading '\', or use the full path though. Don't ask me how
Code:
arun ~ $ \time -o scrap date
Tue Sep 25 01:40:52 IST 2007
arun ~ $ cat scrap
        0:00.01,        0
arun ~ $ /usr/bin/time -o scrap date
Tue Sep 25 01:42:09 IST 2007
arun ~ $ cat scrap
        0:00.00,        0
 
Old 09-24-2007, 03:11 PM   #4
WingnutOne
Member
 
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by matthewg42 View Post
Try using the full path of the command:
Code:
/usr/bin/time
"time" may be an internal command in your shell, a function or an alias.

Now why didn't I think of that?
'cause I'm a , that's why!

Thanks matthewg42, that took care of it!

...But now I'm even more curious about what it was that caused the change. I didn't find any reference to an alias for the time command in any of the usual places (/etc/bashrc, /root/.bashrc, or even in /etc/profile). An alias command didn't turn up anything either.
Where else is something like that likely to be found?

Last edited by WingnutOne; 09-24-2007 at 03:19 PM. Reason: Edit to add a new question...
 
Old 09-26-2007, 10:05 PM   #5
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
Quote:
Where else is something like that likely to be found?
As others have said, time is a bash builtin command. This is from the bash man page regarding how bash executes commands:
Code:
       If  the  command  name  contains  no  slashes,  the  shell
       attempts  to  locate it.  If there exists a shell function
       by that name, that function is invoked as described  above
       in  FUNCTIONS.  If the name does not match a function, the
       shell searches for it in the list of shell builtins.  If a
       match is found, that builtin is invoked.

       If the name is neither a shell function nor a builtin, and
       contains no slashes, bash searches  each  element  of  the
       PATH for a directory containing an executable file by that
       name...
 
Old 09-27-2007, 09:52 AM   #6
WingnutOne
Member
 
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76

Original Poster
Rep: Reputation: 16
Sorry Berhanie. Don't know what I was thinking in that last paragraph; asking a question that I'd just finished thanking matthew for answering.
Chock it up to a long day and not enough sleep I guess.

Thanks again!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
time of command abhishekrahel Linux - Desktop 2 08-24-2007 07:44 PM
what is the command 'time'? buuchanh Linux - Newbie 3 10-13-2005 01:46 PM
time command krock923 Programming 11 07-09-2005 04:46 PM
time command twantrd Linux - General 3 12-08-2004 03:54 PM
See the time of each bash command suguru Linux - Newbie 2 07-24-2004 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration