I assume it is because of the interpreter's implementation. Can开发者_运维技巧 anyone give me a more in-depth answer please? Thanks.
Also, I wonder if bash has a garbage collector?
bash loads a large number of commands from disk. Most other scripting languages have many more instructions that they run internally.
For example, to do a simple computation in bash, you'd use a=`expr 1 + 2`
and bash will first load /usr/bin/expr, run that command which writes the result in the output, bash collects the output (the ` quotes) and saves the result in the variable 'a'. That's definitively slow.
The advantage of bash is the incredible flexibility though. Each person may have a different set of powerful "instructions". For example, I have a small tool called hex to print out numbers in octal, hexadecimal and decimal all at once. Other languages would not integrate in the way bash does...
精彩评论