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 8302971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:24:48+00:00 2026-06-08T17:24:48+00:00

I need to add this to .bashrc echo ‘[[ -s $HOME/.rvm/scripts/rvm ]] && .

  • 0

I need to add this to .bashrc

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

but i am using a shell script and i need to run this under another user so i tried the following..

BASH_COMMAND='[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"'
sudo su ${USER} -c "echo '${BASH_COMMAND}' >> ${HOME_BASE}${USER}/.bashrc"

I was expecting to see

'[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

in my .bashrc

but i see this instead

sudo su ${USER} -c "echo echo 'sudo su ${USER} -c "echo '${BASH_COMMAND}' >> ${HOME_BASE}${USER}/.bashrc"' >> /home/deploy/.bashrc >> ${HOME_BASE}${USER}/.bashrc"

What am i doing wrong with the script

  • 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-08T17:24:49+00:00Added an answer on June 8, 2026 at 5:24 pm

    shell can sometimes misinterpret redirection, you can overcome this with:

    RVM_COMMAND='[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"'
    echo "${RVM_COMMAND}" | sudo su ${USER} -c 'tee -a "$HOME/.bashrc"' >/dev/null
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to add authentication to this function: function multiRequest($data, $options = array()) {
I have this jquery function that works, except I need to add something. I
$_SESSION[{'\'testingrecord'.$testingrecordsfec.'\''}] this originally looked like this ${'testingrecord'.$testingrecordsfec} but I need to add the variables
function addOption(selectbox, val, txt){ ...... } addOption(list, Cars, Cars); I need to add this
I can't access a element with its href. Like this example, i need add
I have a java.util.Set<City> cities and I need to add cities to this set
I need to add a checkbox with text Send a copy of this email
I need to add and delete class on an element having multiple classes: This
I need to add indexes to my table (columns) and stumbled across this post:
I need to add default value column in SqlServer Compact....i am new to this

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.