Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Why doesn't the whereis command give any information about the export command? How does the export command work even if the shell path variable is set to null?

share|improve this question
2  
whereis is a nonstandard and not very useful command. type is better, because it is a builtin and should usually tell you how a command is resolved -- as a builtin, function, or non-builtin. Unfortunately POSIX has little to say about the details of type, so you have to check your shell's manual for what options it supports. whence is another command used by some shells and is similar to type. –  ormaaj Dec 8 '12 at 16:12
add comment

1 Answer

up vote 7 down vote accepted

whereis doesn't show you a binary for export because it's a shell builtin. You can find it in the bash man page. As it's a builtin, not a binary, the shell doesn't search the PATH for it, so it will work regardless of the current path. Incidentally, this is why you are advised to use type to see what is being executed when you give a command:

$ which export
$ whereis export
$ type export
export is a shell builtin
share|improve this answer
    
@Kevin Where could I get information about built in export. What are the other built ins? –  user3539 Dec 8 '12 at 15:54
    
@manatwork yes, I was just editing that in as you posted it. –  Kevin Dec 8 '12 at 15:55
    
If you look at man bash, you'll see probably see BASH BUILTIN COMMANDS near the top. –  TAFKA 'goldilocks' Dec 8 '12 at 15:56
    
@user3539 you can see all the builtins in bash's man page, or the bash reference manual. –  Kevin Dec 8 '12 at 15:57
4  
For documentation about a specific bash command, use help: help export. Also, type -a shows you all the ways the command is found (alias/function/builtin/external) –  glenn jackman Dec 8 '12 at 18:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.