Search code examples
bashrpm-spec

What does the || : in this line of bash script from an rpm spec file do?


ln -s /var/log/$SERVICE_NAME $RPM_INSTALL_PREFIX/logs || :

In the rpm spec file every line ends with || :

What is the significance of the || : and why is it there?


Solution

  • It causes any error to be ignored so that the rpm operation isn't canceled.

    || causes the next command to run if the previous command failed, and : always succeeds.