2022年7月8日(金) 19:29 Alex fxmbsw7 Ratchev <fxmb...@gmail.com>: > > > ls -l /production/path | mail -s "all-good" not...@company.com || > > > true # Not critical > > > > small side note there, a || true is big slow imho
What does it mean? If you are talking about the execution time, "|| true" is much faster than spawning external processes like "ls" and "mail". I've measured it in my system, but the overhead by "|| true" is about 270ns (assuming the error basically does not happen if the environment is properly set up) while the overhead by a pipe "ls -l | cat -v" (where I replaced "mail ..." with "cat -v") is about 6630200ns. The main command is 2.5x10^6 times slower. In real cases, I would expect that "mail" would take much more time than "mail". Even if the main command does not "fork" or "exec" new processes, I believe 270ns is always negligible. -- Koichi