Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8701623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:26:44+00:00 2026-06-13T02:26:44+00:00

I am working with bash and still unfamiliar with the difference between .profile ,

  • 0

I am working with bash and still unfamiliar with the difference between .profile, .bashrc, .bash_profile.

My desired result is to have the ruby version and rvm gemset show up on my bash prompt.

I added PS1="\$(~/.rvm/bin/rvm-prompt) $PS1" to .bash_profile (via xcode) and it displays

ruby-1.9.3-p286 John-MacBook-Air:~ john$

What I trying to get is

ruby-1.9.3-p286@rails3 $

With “rails3” being the output of rvm gemset.

How do I get John-MacBook-Air:~ john removed from the prompt?

I tried adding the line in the .profile, and .bashrc with no luck but it seems to work in the .bash_profile. Any clarification between these files would be greatly appreciated. I am running rvm on a Mac.

SOLUTION

include the following to the .bash_profile

PS1='\W \$ '
PS1="\$(~/.rvm/bin/rvm-prompt) $PS1"

the prompt looks like

ruby-1.9.3-p286@rails3 ~ $ 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:26:45+00:00Added an answer on June 13, 2026 at 2:26 am

    This line is the problem:

    PS1="\$(~/.rvm/bin/rvm-prompt) $PS1"
    

    What you’re saying there is “add my rvm prompt to PS1” and then put the pre-existing PS1 at the end. The system’s default PS1 is setting this:

    PS1='\h:\W \u\$ '
    

    In that setting \h is the hostname (here ‘John-MacBook-Air’), \W is the current working directory with your home directory abbreviated to ~, \u is your user’s login name (here ‘john’) and \$ will show a dollar sign if you are a regular user and an octothorpe (#) if you’re logged in as root. On OSX, that is set by default in /etc/bashrc. If you want to change the prompt, you need to customize the latter part of the prompt rather than just re-entering $PS1 as is back into the new setting. Removing the hostname is common, but I would very strongly recommend against removing the current working directory. It’s very useful information when in a terminal session. Just my two cents.

    To see what you can put there, take a look for information about setting your prompt in Bash.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Git (version 1.7.2.5) bash compeletion working on my Debian squeeze (6.0). Git
I am working in linux bash environment, and I have many files to edit,
I am using Solaris 5.10 and working on Bash Shell . I have a
Based on my previous thread : RVM installed by Ruby not working? where i
Beginner here trying to get a pipeline working in bash. If somebody can see
I'm working on porting bash script to SUS/POSIX-compliant shells. I was able to remove
I am working in a bash script where I need to analyze the output
I am working on a Bash shell script that does something like this: #!/bin/bash
I'm working on a Bash shell script that runs several Python scripts like so:
How could I retrieve the current working directory/folder name in a bash script, or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.