# An annotated guide to Jon's .bashrc

## .bashrc

I have a very basic bash setup for the labs (however there is a lot of hidden stuff going on which I will explain later). In general I use this setup to add some aliases for commands I use a lot and to add some extra tools which are not part of the general build.

The following is my .bashrc, if you want you can just copy this into your ~/.bashrc and use it.

source /etc/profile.d/prompt.sh
alias ls='ls --color'
alias ll='ls -al'
alias rm='rm -i'
alias code='/public/devel/2021/VSCode-linux-x64/code --no-sandbox '
alias rg='/public/devel/2021/bin/rg'
alias mayapy='/opt/autodesk/maya/bin/mayapy'
alias mysqlsh='/public/devel/2021/mysqlsh/bin/mysqlsh'
export PATH="/home/jmacey/.pyenv/shims:${PATH}:/public/devel/2021/swig/bin/" export PYTHONPATH=$PYTHONPATH:~/NGL/lib


What I will do next is explain what each line does and my motivation for adding it.

## source /etc/profile.d/prompt.sh

This line executes the script /etc/profile.d/prompt.sh using the source this sets some command prompt variables.

export PS1="[$\e[33m$\u$\e[m$@$\e[31m$\h:\W$$\e[m$]" export PS2="[$\e[33m$\u$\e[m$@$\e[31m$\h:\W$$\e[m$]"


These variables PS1-PS4 set different prompt levels depending upon how you are logged in. These commands set the prompt to be [Username@Hostname:CurrentDiR] so my root is [jmacey@w11901:~$] The escape codes set colours and other elements. It is possible for you to override this into your own custom prompt, by using the export command. For example this prompt created using the excellent https://bashrcgenerator.com/ will give you a git status for the current directory (if a repository) export PS1="[\H]@\u\n\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* $$.*$$/(\1)/')$(tput sgr0)$"


To make this work you just need to add it after the call to source /etc/profile.d/prompt.sh or remove it (you can use # in .bashrc as a comment)

## alias ls='ls --color'

This line uses the alias command to default the ls to use ls --color by default. In general most linux distributions seem to do this but not the version we are using.

This uses the export function to prepend to the $PATH environment variable the location of pyenv. I use pyenv to allow me to setup and install different python versions. It is not needed unless you need to play with different python versions. For more details see the pyenv install here #### export PYTHONPATH=$PYTHONPATH:~/NGL/lib

This export add the location of NGL/lib to the python path so the pyngl library can be used. This takes some extra setup with NGL which is documented in the NGL readme files

# Is that all?

Not really, when you login there are actually a number of scripts that run to setup the bulk of the environment for the user.

In particular the file /etc/profile.d/developer.sh is run for each user to setup the developer tools, environment variables for CMAKE and RENDERMAN. In the most part these are all used in programming / technical roles an are of no interest to most people so are hidden away.

The contents can be seen here.

export PATH=$PATH:/public/bin/2021:/opt/qt/5.15.2/gcc_64/bin:/opt/qt/Tools/QtCre ator/bin export CMAKE_TOOLCHAIN_FILE=/public/devel/2021/vcpkg/scripts/buildsystems/vcpkg. cmake export CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:~/NGL:/opt/qt/5.15.2/gcc_64/lib/cmak
e/
export CMAKE_MODULE_PATH=/opt/qt/5.15.2/gcc_64/lib/cmake

# Setup modern compilers
# this set the default compiler tool-chain to be devtoolset-7
source scl_source enable devtoolset-9
source scl_source enable llvm-toolset-7

# update package config
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/public/devel/2021/vcpkg/installed/x64-l inux/lib/pkgconfig export RMANTREE=/opt/pixar/RenderManProServer-24.1 export PATH=$PATH:$RMANTREE/bin export PYTHONPATH=$PYTHONPATH:\$RMANTREE/bin