The value of the colon in bash after a double tube

I am trying to understand this piece of code:

. functions.sh || { : ; echo "Error while loading the specified file" >&2; exit 2; } 

I get that the code in parenthesis is called when the specified file is unavailable. But what does it mean:; ? Moreover, when you delete it, the script does not work.

+6
source share
1 answer

The double is an empty statement , so it does nothing. A semi-colon completes the list of commands .

Not sure why someone would write above, basically “do nothing and then do echo ”, which seems to be simplified. Maybe someone copy a pack of luggage.

+16
source

Source: https://habr.com/ru/post/944201/


All Articles