printf gives more control over the output, it’s more portable and its behaviour is defined better. For various reasons, printf is preferable to echo.E.g.: $ \time bash -c "dnf list installed | wc -l"ġ.32user 0.12system 0:01.45elapsed 99%CPU (0avgtext+0avgdata 97596maxresident)kĠinputs+136outputs (0major+37743minor)pagefaults 0swaps Prepend a command with \ to override alias/builtin lookup. Always use $(cmd) for command substitution (as opposed to backquotes).Use stdout and greping to communicate status. Some loops happen in subprocesses, so don’t be surprised when setting variabless does nothing after them.Positional parameters of the script should be checked, those of functions should not. Variables should always be referred to in the $.If you need global variables, make them readonly.Prefer local variables within functions over global variables.Use nohup foo | cat & if foo must be started from a terminal and run in the background.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |