views:

40

answers:

2

I've been advised to remove the return command from my bashrc file in order to allow Ruby Version Manager to function properly. Do I simply delete the return command, or do I replace it with some other command? I am hesitant to mess with my System-wide shell without some proper direction. But I would really like to get RVM working as it is a time saver.

My bashrc is located in the etc directory and looks like this:

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
if [[ -s /Users/justinz/.rvm/scripts/rvm ]] ; then source /Users/justinz/.rvm/scripts/rvm ; fi

The last line, is an insert, described in the RVM installation.

+1  A: 

The last line uses a file in a specific user's home directory, and as such should not be in the system-wide bashrc, since only root and that user will have access to that file. Best to place it in that user's ~/.bashrc instead.

Ignacio Vazquez-Abrams
Where is the user's .bashrc file or is this something I should create for this user? I've looked everywhere
JZ
It would be in `~`, the user's home directory.
Ignacio Vazquez-Abrams
+2  A: 

I wouldn't. That return is probably there for a good reason. It obviously doesn't want to execute anything after that if the PS1 variable is empty.

I would just move the inserted line up above the if statement.


In addition, if that's actually in the system-wide bashrc file, you should be using something like:

${HOME}/.rvm/scripts/rvm

rather than:

/Users/justinz/.rvm/scripts/rvm

I'm sure Bob and Alice don't want to run your startup script.

If it's actually your bashrc file (in /Users/justinz), you can ignore that last snippet above.

paxdiablo
Thanks. tried this, but rvm doesn't function.
JZ
Note to self and others in the future, this did not solve the issue but it is a correct answer. Don't mess with the return, its there for good reason.
JZ