1 Many shell programmers are in the habit of using calls to external commands 2 instead of using shell built-in commands (an example of this is a call to 3 usr/bin/echo instead of using the echo command built into the shell. 4 5 This script shows sh_wasted.d tracing a shell script that calls /usr/bin/echo 6 instead of using the built-in. 7 8 # sh_wasted.d -c ./func_waste.sh 9 Tracing... Hit Ctrl-C to end. 10 Function A 11 Function B 12 Function C 13 Script duration: 3101631 us 14 15 External command elapsed times, 16 FILE NAME TIME(us) 17 func_waste.sh sleep 3019573 18 19 Wasted command elapsed times, 20 FILE NAME TIME(us) 21 func_waste.sh /usr/bin/echo 26510 22 23 You can see that the calls to /usr/bin/echo took around 26 thousand 24 microseconds; time wasted by the shell having to access an external command. 25 26 27 Here we trace the same script, except it uses the shell built-in echo command. 28 29 # sh_wasted.d -c ./func_abc.sh 30 Function A 31 Tracing... Hit Ctrl-C to end. 32 Function B 33 Function C 34 Script duration: 3032616 us 35 36 External command elapsed times, 37 FILE NAME TIME(us) 38 func_abc.sh sleep 3012920 39 40 Wasted command elapsed times, 41 FILE NAME TIME(us) 42 43 The total time here is less and there are no 'wasted' calls to external 44 commands. 45 46