thepracticaldev.com thepracticaldev.com

Why is /usr/bin/test 4Kb smaller than /usr/bin/[?

A Reddit user named mathisweirdaf shared some interesting observations: $ ls -lh /usr/bin/{test,[} -rwxr-xr-x 1 root root 59K Sep 5 2019 '/usr/bin/[' -rwxr-xr-x 1 root root 55K Sep 5 2019 /usr/bin/test [ and test should be aliases of each other, and yet there is a 4Kb difference between the GNU coreutils that execute them. Why? First of all, for all those who were wondering: yes, there is /usr/bin/[. On this topic I have a...

programmer group

Output of "time" command in shell (bash)

preface I believe we all know that time under Bash is a very useful command. It can time the execution of a script or a program, which is usually very convenient when roughly comparing the execution efficiency of a program. However, you will find that the time text output by the time command cannot be simply redirected, for example, to a text file, which can only be displayed on the screen, which is very inconvenient for non...

programmer group

Arithmetic operation and file search in learning bash script programming

Arithmetic operation Compared with other programming languages, bash can not be expressed directly in the form of variable plus variable; for example, we first declare two variables num1 and num2, and then do the operation. num1=2 num2=3 echo "$num1+$num2" 2+3 The result we show here is 2 + 3, which is just the replacement of variables, not the addition of two variables. In Bash, variables are stored in string type by default. Even...