Comments (5)
@pariaspe I tested adding stuff in ~/.bash_profile and ~/.profile and opened a new terminal using docker exec
and ran ros2 list and got errors indicating the files weren't sourced, this is probably due because our shells aren't executed with --login
TL;DR ~/.bash_profile won't work for us
from roboticsacademy.
ROS packages are sourced from .bashrc
which is meant to be used in interactive sessions only:
$ head ./bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Script is returning before sourcing when the entrypoint is run directly. Easiest way to solve is to overwrite .bashrc
file. We can also create another script for sourcing or source it from entrypoint.sh
directly (or .env
). What do you think @pawanw17 ?
from roboticsacademy.
Having the sources in .bashrc certainly helps during debugging and development, as we don't have to source them every time we open a new terminal attached to docker. I was wondering if there is a file that is sourced in both interactive and non-interactive shells.
I am not sure maybe overwriting .bashrc could lead to other errors, not too confident of this solution.
I'd suggest that we have it in .bashrc as well as .env/entrypoint.sh
from roboticsacademy.
Ok, then I'll create a .bash_profile
with all needed sources and this file will be source both in .bashrc
and entrypoint.sh
.
Also, I've been reading bash
manual entry and I might come with another solution:
$ man bash
...
The following paragraphs describe how bash executes its startup files.
If any of the files exist but cannot be read, bash reports an error.
Tildes are expanded in filenames as described below under Tilde Expan‐
sion in the EXPANSION section.
When bash is invoked as an interactive login shell, or as a non-inter‐
active shell with the --login option, it first reads and executes com‐
mands from the file /etc/profile, if that file exists. After reading
that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
in that order, and reads and executes commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
When an interactive login shell exits, or a non-interactive login shell
executes the exit builtin command, bash reads and executes commands
from the file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist. This may be inhibited by using the --norc option.
The --rcfile file option will force bash to read and execute commands
from file instead of /etc/bash.bashrc and ~/.bashrc.
When bash is started non-interactively, to run a shell script, for ex‐
ample, it looks for the variable BASH_ENV in the environment, expands
its value if it appears there, and uses the expanded value as the name
of a file to read and execute. Bash behaves as if the following com‐
mand were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but the value of the PATH variable is not used to search for the file‐
name.
from roboticsacademy.
Many thanks for the testing @pawanw17 👍
I figured out a smoothly way to do it. It works for non-interactive and interactive shells. Setting BASH_ENV to the file where we are setting up the environment: .env
from roboticsacademy.
Related Issues (20)
- Installing Gazebo11 side by side with Gazebo Harmonic
- Optimized exercises HOT 3
- [3D reconstruction] Migrate interfaces to hal_interfaces
- exercise template refactor for Unibotics
- Update node-sass to sass
- On Refreshing the Follow Line Exercise HOT 4
- [Autoparking] Add back all the worlds
- [Follow person] Add hybrid spin
- [3D reconstruction] Does not work on Chrome or Chromium based browsers HOT 8
- Adding information of the original reference system in amazon warehouse HOT 4
- [gh-pages] Update Amazon Warehouse exercise's Hints section documentation HOT 1
- Add docker-compose.yaml in gitignore
- Update Robotics Academy Image in compose_cfg HOT 2
- Switch all GUI's from two class to only one HOT 5
- [Digit classifier] Migrate to ROS2 humble / superthin template
- Fix refactor Django templates for unibotics integration
- [Amazon Warehouse] Add getSimTime() function in HAL module HOT 2
- Update ROS1 drone exercises to ROS2 Humble +superthin templates +Aerostack2
- Maps’ static images in certain exercises (Amazon Warehouse, …) do not load in Unibotics when using Robotics Academy as a submodule
- [Frontend] AceEditor should have tab size 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roboticsacademy.