Check command availability
Scripting languages usually call other scripts or binaries. When calling commands that may not exist, please check whether they are available. Huo Ying IT Training suggests that you can use "command -v binary name" to perform this operation and see if its exit code is zero.
Independent of the current working directory
If you run the script from a different directory, an error may occur. Nobody likes this script. To solve this problem, it is best to use the absolute path and relative path of the script.
Read input
There are two ways to use script input: environment variables and option labels. Generally speaking, Huo Ying IT training suggests that environment variables can be used without affecting the script behavior, and script parameters can be used for the values of different processes that can access the script.
Animation display progress
Some commands take a long time to execute, and not all scripts display a progress bar. When users wait for asynchronous tasks to complete, there are several ways to inform them that scripts are being executed.
Color coded output
When other binaries or scripts in the script are called, their outputs are color-coded so that you can know which output comes from which script or binary file. Therefore, Huo Ying Computer Training believes that we don't need to find the required output in full-screen black-and-white output text.