Meaning of colon in Bash after a double pipe

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 the bracket is called when the specified file isn't available. But what does this : ; mean? Moreover, when you delete it, then the script doesn't work.

Answers


The colon is null statement, so it does nothing. The semi-colon ends a list of commands.

Not sure why anyone would write the above, it's basically "do nothing, then do the echo" which seems like it could be simplified. Could be somebody's copy-paste baggage.


Need Your Help

Reference Object Property with JSON.Net when property has special characters

c# xml json json.net

I am using JSON.Net to update an object within an XML File. This works great! However, I need to update a property that has some special charecters in it and I can't find any information out there ...

HQL syntax problem

sql hibernate hql

I have a problem with the following HQL query:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.