Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

By accident, I ran the command

exec $SHELL -l

in my terminal, and it changed how my prompt looks

Macintosh:~ myname$ exec $SHELL -l
Macintosh-2:~ myname$ cd

i.e. there's a "-2" after Macintosh

Macintosh:~ myname$
Macintosh-2: myname$

I'm not sure if this might be responsible for some problems I'm having on my system.

I'm trying to use Ruby 1.9.3 on my system, which I installed with Rbenv.

rbenv version

However, when I try to install gems, i'm getting an error message that they require at least ruby 1.9.2, so I'm assuming that the machine is still using the version of Ruby that comes with my Mac. I tried to fix this by

gem install bundle
rbenv rehash
bundle install

but I keep getting the same error message about needing at least Ruby 1.9.2, so I'm wondering if the effect of running exec $SHELL -l is preventing gems from installing for some reason.

share|improve this question
What shell are you using? (The most likely answer is bash, but csh, ksh, and zsh are a few other possibilities.) What do you see if you type echo $SHELL? (The answer to this question will probably give you the answer to the first question.) What happens if you logout and login again (or start a new shell window; whichever is applicable)? What “problems” are you having? – Scott Jan 2 '13 at 3:09
@Scott I'm on a Mac, mountain lion. I'll explain my problem in an update to the OP. – BrainLikeADullPencil Jan 2 '13 at 3:24

$SHELL refers to your shell (command interpreter).  Most shells recognize the –l (lowercase L) option to mean that it is a “login shell”, which primarily means that it reads and processes extra command files (e.g., csh always reads .cshrc, but if it is a “login shell”, it also reads .login).  You have started a new shell processes running and told it to act like “login shell”.

Some shells (I believe bash is one) keep track of hierarchical shell processes and let the user display the depth, or level.  This is often incorporated into the shell prompt, as in:

 (prompt string)pwd
 (prompt string)$SHELL
 (prompt 2 string)cd ../dir2                # Note that the shell level is2,
 (prompt 2 string)rm *                            # indicating that you are in a new shell process.
 (prompt 2 string)exit
 (prompt string)pwd                                   # Note return to original shell process.

This shouldn’t have anything to do with your problem with RubyGems.

share|improve this answer
thanks, but I can't get it back to the original shell level. I tried 'exit' and it logs out but when i open a new terminal window it's the shell level 2 again – BrainLikeADullPencil Jan 2 '13 at 4:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .