mert inan
mert inan

Reputation: 1597

Does bash have its own echo, printf, [ functions?

when I trace output of the of nice.sh script with strace, I see tons of child processes.

strace -ff -o nice.o ./nice.sh 

nice.sh

#!/bin/bash

while /usr/bin/[ 1 ]
do
    echo ..;
done;

On the other hand if I run the script below, I do not see any forked child process:

#!/bin/bash

while [ 1 ]
do
    echo ..;
done;

The same is also true for echo, /bin/echo and printf, /usr/bin/printf. Does it mean that some commands are embedded into bash? If yes, what are the other commands?

Upvotes: 1

Views: 179

Answers (1)

pb2q
pb2q

Reputation: 59617

Yes, bash, and the other shells each have numerous builtins.

Here's the list for bash with accompanying documentation for each builtin.

Upvotes: 2

Related Questions