-
Notifications
You must be signed in to change notification settings - Fork 4
Environmental Variables
Environmental variables in Linux are variables that contain information about the operating system and user environment. They can be used by programs and scripts to access system resources or to store configuration settings.
To change environmental variables in Linux, you can modify the values in the ~/.bashrc or ~/.bash_profile files and then source them using the source command. This will apply the changes immediately.
In regular linux, read up using export in bash. In our repository, many helper functions help change environmental variables temporarily (within a terminal) or persistently. See commands pexport, punset, setbotmaster, setdevmaster, etc.
-
To check the value of a specific variable, use
echo $VARIABLE_NAME. -
To list all environmental variables, use the
envcommand. -
To find specific variables, use the
grepcommand with a keyword or pattern to search for.Example
To find all environmental variables containing the word "HOME", you can use the following command:
env | grep HOMEThis will list all environmental variables that contain the word "HOME", such as
HOME=/home/usernameandXDG_DATA_HOME=/home/username/.local/share.
-
PATH: Linux path for finding executables -
HOME: The user's home directory -
PWD: The current working directory -
USER: The current user's username -
SHELL: The user's default shell
The following are defined in ~/.bashrc
-
CATKIN_WS_PATH: Where thecatkin_wsis, used forcdws; defaults to~/catkin_ws -
GRA_REPO: Used forcdrepo, defaults to~/gra -
DOCKERFILE: Used forRUNscript, described below; defaults to$GRA_REPO/.devcontainer/Dockerfile -
DEV_MASTER_URI: The development machine (Docker’s) master URI, assuming we are using the same machine for theroscore -
DEV_BOT_HOSTNAME: The hostname / IP to find the robot, used for various remote scripts to the robot. -
DEV_BOT_USERNAME: The username in which we should use to login to the bot -
DEV_BOT_MASTER_URI: The address whereroscorewould live in, if we are using the bot as the master. -
DEV_ENV: Helper variable to indicate if we are in the Docker, or the bot. -
ARDUINO_UPDATE_PORT: The port in which we should flash the Arduino with inau
-
ROS_MASTER_URI: Specifies the URI of the ROS master. Manages the communication between the different nodes in a ROS system. -
ROS_HOSTNAME: Specifies the hostname or IP address of the machine running the ROS node. Identifies the computer running the node to other nodes in the system.