Bash -C "Source ~/. Profile" Doesn't Source ~/. Profile
Here's Some Output from Inside a Docker Container (Running Ubuntu 18.04) Which Seems to Be Acting Up. # Source ~/. Profile Net. Ipv4. Ipfrag_High_Thresh =...
Here's some output from inside a Docker container (running Ubuntu 18.04) which seems to be acting up.
# source ~/.profile
net.ipv4.ipfrag_high_thresh = 134217728
net.core.rmem_default = 10485760
sourcing /opt/ros/foxy/install/setup.bash
ROS_ROOT /opt/ros/foxy
ROS_DISTRO foxy
# bash -c "source ~/.profile"
# /bin/bash -c "source /root/.profile"
#
The output from the first command is something I expect from the following commands. Feels like I'm missing something obvious here. For context, I need /bin/bash -c "source /root/.profile" to work because I don't want to have to enter the Docker container in order to run my commands, and I want to run the stuff in .bashrc prior to running them. Where am I going wrong?
1 Answer
In .bashrc:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Following command works fine:
/bin/bash -ic "source ~/.bashrc"