3 ms·
"echo" isn't a command?
by andrewcooke 17y ago
"echo" isn't a command?
- cduan 17y agoIn some shells (such as tcsh) it is a built-in command like "if" or "cd".
- andrewcooke 17y agoyeah, i wondered about that (in bash it's /bin/echo, fwiw - i looked).
- thwarted 17y agoHuh? /bin/echo is an executable, all shells should invoke that binary when given a path to it. In bash, echo is a builtin (it appears in the SHELL BUILTIN COMMANDS section of the man page between disown and enable). bash$ echo --help # the builtin --help bash$ /bin/echo --help # the executable Usage: /bin/echo [SHORT-OPTION]... [STRING]... or: /bin/echo LONG-OPTION Echo the STRING(s) to standard output. (and a bunch of other GNU help text)
- andrewcooke 17y agoah, ok. that makes sense. i just did "which echo" without thinking enough....
- tome 17y agoTry "type echo". If "which" is not a builtin (which it isn't in bash, but is in zsh) then it can't tell you about builtins!
- ax0n 17y agoWhile it's vague, I think the spirit of the "challenge" is that once a command has been used, you should not use it again. Although one can make a cat() function in bourne-esque shells such as bash quite easily: cat() { while IFS="" read l ; do echo "$l" ; done < $1 ; } ; cat /var/tmp/xmas.txt :P Bunch of other stuff you can do with only bash built-ins if you manage to completely hose your box but still have a root shell: http://www.h-i-r.net/2009/08/cratered-your-linux-box-here-are-some.html http://www.h-i-r.net/2009/08/cratered-your-linux-box-here-ar...