I found this command. I understand the source reloads the bash profile and fixed permissions for Ruby permissions needed on Ubuntu. But what does the part before && mean?
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s break it down:
the
[[and]]enables advanced functionality that is more similar to traditional programming languages, allowing constructs like||instead of-oand&&instead of-a.For more information on this see How to use double or single brackets, parentheses, curly braces but as far as I know
-sdoes not need the extra functionality and the double brackets could be replaced with single brackets)the
-stests whether the file exists and is non-empty&&will automatically run the command on the right, as long as the command on the left executes without an error return code.So, the statement tests whether the file exists and is non-empty, and if so it will source it into the current shell environment.