LinuxQuestions.org
Help answer threads with 0 replies.
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 06-05-2011, 12:35 PM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Rep: Reputation: 76
Does 'time' run the internal time command or the external one?


Hi:

For some shell built-in commands there are external commands with the same name and identical or nearly identical behaviour (they do the same thing). Suppose foo is such a name. What does this do?
Code:
$ foo
Runs the internal or external command? Thanks.
 
Old 06-05-2011, 12:56 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

When bash executes the command it looks for it in this order:

1 - alias,
2 - keyword,
3 - function,
4 - built-in,
5 - executable (external).

If foo is an alias, function and executable name, the alias will be executed.

Hope this helps.

EDIT:

Run: command -V <command> to check which is used.

Last edited by druuna; 06-05-2011 at 01:05 PM. Reason: Added command -V
 
1 members found this post helpful.
Old 06-05-2011, 01:38 PM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Hi:

I typed 'command -V time' and was said 'time is a shell keyword'. I had looked (bash man) under SHELL BUILTIN COMMANDS and did not find time. The only place I found it was in the definition of pipeline. Which now makes very good sense. Thanks for the list.

Last edited by stf92; 06-05-2011 at 07:02 PM.
 
Old 06-05-2011, 01:56 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

help time also gives some information, although the pipeline section in man bash is better (my 2c).

Hope this helps.
 
Old 06-05-2011, 07:19 PM   #5
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thanks a lot, druuna, and kind regards.

Quote:
Originally Posted by druuna View Post
Hi,

help time also gives some information, although the pipeline section in man bash is better (my 2c).

Hope this helps.
Out of sheer curiosity: what does 2c stand for? Anything to do with bash version number?

Last edited by stf92; 06-05-2011 at 07:22 PM.
 
Old 06-06-2011, 01:20 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
2c = 2 cents ..
YCMV (Your Currency May Vary)
 
Old 06-06-2011, 02:04 AM   #7
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Thanks chrism01. That is the bad fortune with non-native English speakers in an English speaking forum. Everything has to be explained to us (and everything IS explained). Although there are native speakers who speak English very well. Not my case.

Now, I'll write in a linguistics forum to understand what druuna meant by his two cents.
 
Old 06-06-2011, 02:55 AM   #8
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Sorry I confused you, I thought this one was well known in the on-line community.

This is what Wiki has to say about this one: My two cents
 
Old 06-06-2011, 04:11 AM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 4,442

Original Poster
Rep: Reputation: 76
Getting into Wiki was the first thing I did. But I missed the expression. An innocent idiom and one is lost. What a patience on the part of you guys.
 
  


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
how to understand user time, sys time, wait time, idle time of CPU guixingyi Linux - Server 1 08-24-2010 10:10 AM
missing libraries every time i run a command (except cd) starkes Linux - Software 4 12-31-2008 04:25 PM
Script that will run a command, time it etc. kinetik Programming 7 06-20-2006 04:42 PM
how to run command in two ttys of same computer at the same time? pwangee Linux - Networking 2 07-16-2004 01:17 PM
how to run command in two ttys of same computer at the same time? pwangee Linux - General 1 07-15-2004 01:29 PM

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

All times are GMT -5. The time now is 08:43 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