Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[setup-auto-sourcing] check for commented sourcing in ~/.bashrc #205

Open
YaraShahin opened this issue May 4, 2024 · 0 comments
Open

[setup-auto-sourcing] check for commented sourcing in ~/.bashrc #205

YaraShahin opened this issue May 4, 2024 · 0 comments

Comments

@YaraShahin
Copy link

YaraShahin commented May 4, 2024

Hello

This is not an issue, but it could be an imporvement. I setup ros_team_workspace with autosourcing a while ago, but I commented out the following lines from my ~/.bashrc when I stopped using it:

if [ -f ~/.ros_team_ws_rc ]; then
    . ~/.ros_team_ws_rc
fi

When I wanted to use it again by running the command setup-auto-sourcing, I expected it to add the lines again or remove # but it didn't modify my ~/.bashrc at all. This is probably because of this condition in setup_auto_sourcing.bash:

if ! ( grep -q '\..*\.ros_team_ws_rc' $bashrc_location || grep -q 'source.*\.ros_team_ws_rc' $bashrc_location ); then
    echo "" >> $bashrc_location
    echo "# automatically source RosTeamWorkspace if the .ros_team_ws file is present in your home folder." >> $bashrc_location
    echo "if [ -f ~/.ros_team_ws_rc ]; then" >> $bashrc_location
    echo "    . ~/.ros_team_ws_rc" >> $bashrc_location
    echo "fi" >> $bashrc_location
fi

This checks that . ~/.ros_team_ws_rc exists without checking if it was commented out (if there's a # at the start of the line.

Steps to reproduce:

  1. Clone repo (master) & run source setup.bash
  2. run setup-auto-sourcing
  3. Go to ~/.bashrc & comment out the lines:
if [ -f ~/.ros_team_ws_rc ]; then
    . ~/.ros_team_ws_rc
fi
  1. run setup-auto-sourcing again.
  2. You'll notice that the setup.bash isn't sourced because the lines in ~/.bashrc aren't included back in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant