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.

Don't ask why, but is there a Unix command that takes no arguments?

share|improve this question
    
Are you looking for a command that would error if given arguments, or that just don't process their arguments? I'm not immediately thinking of any in the former category (though one would be easy to create, and they may well exist), but the latter category has various examples. And of course there are many unix commands that do something useful without any arguments, but I'm guessing that's not what you're asking. –  lindes Feb 22 '11 at 9:56
7  
I can't help myself. Why? :P –  gnud Feb 22 '11 at 14:11
add comment

3 Answers

true and false are two examples.

Or did you mean commands that take no options? I can't think of any, but the original Unix version of echo didn't take any options. There's even a story about it how it came to take options.

share|improve this answer
    
yes is another one. –  asoundmove Feb 22 '11 at 12:44
1  
@asoundmove yes doesn't require an argument, but it does accept/use one. –  gnud Feb 22 '11 at 13:43
1  
As is so often the case, this largely depends on what Unix implementation you are using. Yes, POSIX doesn't specify any arguments for true, but that doesn't stop the GNU project: true --help yields Aufruf: /bin/true NAME oder: /bin/true OPTION Aufruf: %s [ignorierte Kommandzeilen-Argument] oder: %s OPTION Mit einem Status-Code beenden, der erfolgreiche Ausführung signalisiert. (21 lines total.) You'll notice that it is even localized! –  Jörg W Mittag Feb 22 '11 at 19:32
add comment

nologin takes no arguments and is widely available on Linux and BSD.

On CentOS 4 and 5, the arch command takes no arguments. On other linux distros, arch is now provided by GNU coreutils which takes --version and --help. With CentOS 4 and 5 it comes from util-linux which differs from GNU's version.

A lot of the things in GNU coreutils take only --help and --version, if you look at different Unixes that don't use GNU coreutils, they don't accept any arguments: sync, true, false, whoami, pwd, groups, users

share|improve this answer
add comment

:, true, false, reset, clear, line, chkdupexe and arch all take no arguments.

I'm sure they accept them, but they ignore them.

share|improve this answer
    
OMG.. true and false are commands!... must try this: true; echo $? ... 0 | false; echo $? ... 1 ... yup! ... an ineresting bit if info... bash is different :) –  Peter.O Feb 22 '11 at 17:17
add comment

Your Answer

 
discard

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