LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What does the || true do in the mesg command do? (https://www.linuxquestions.org/questions/linux-newbie-8/what-does-the-%7C%7C-true-do-in-the-mesg-command-do-4175576395/)

mikenash 04-01-2016 08:36 AM

What does the || true do in the mesg command do?
 
mesg n || true
Found this mseg command in a .profile that causes an error when logging into the user on lightvm. I would like to know what
mesg n || true is doing. I understand that the mesg n is a do not disturb but I do not understand the || true part.
What does the || true do in the mesg command do?

cepheus11 04-01-2016 09:50 AM

It forces the whole expression to exit with a success status: The operator "||" means the command to the right is only executed if the command beforehand exited with a "failure status" (exit code != 0). The "true" command does nothing but exit with exit code 0 which means "success".

mikenash 04-01-2016 10:14 AM

Thank You.


All times are GMT -5. The time now is 12:08 AM.