1

echo is bash builtin. Is there an external command which can do the same thing as echo? (may do more)

  • printf(1) might also be handy for some needs. – thrig Mar 4 '16 at 20:59
  • When do you use builtin printf and when external printf? – Tim Mar 4 '16 at 21:09
5

There's echo:

$ /bin/echo --version
echo (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Brian Fox and Chet Ramey.

Shell builtins which don't change the state of the shell are also often implemented as external commands - [/test is a famous one, so is printf:

$ /bin/printf --version
printf (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

If you have busybox, it is also likely to support echo:

$ busybox echo --version
--version
  • Thanks. What are the differences between the two, in purposes and in ways for usage? – Tim Mar 4 '16 at 20:15
  • @Tim No difference in purpose. They may accept different flags - check the manpage on your system to know for sure. – muru Mar 4 '16 at 20:16
  • How do you invoke echo as an external command? Full path? (can it be less complex?) – Tim Mar 4 '16 at 20:17
  • @Tim try some of the methods given in unix.stackexchange.com/q/86266/70524 – muru Mar 4 '16 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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