Created
May 11, 2025 19:11
-
-
Save pnsinha/fbd8e94f0388fdef727d20598429d980 to your computer and use it in GitHub Desktop.
.bashrc script in midway3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Check if shell is interactive (more reliable than PS1 check) | |
| case $- in | |
| *i*) ;; | |
| *) | |
| # Minimal environment for non-interactive shells | |
| export TMPDIR=/tmp/$USER | |
| export TMP=/tmp/$USER | |
| mkdir -p $TMPDIR | |
| PATH="$PATH:$HOME/bin" | |
| return;; | |
| esac | |
| # Source global definitions | |
| if [ -f /etc/bashrc ]; then | |
| . /etc/bashrc | |
| fi | |
| ############################################################################### | |
| # XDG variables | |
| ############################################################################### | |
| export XDG_CACHE_HOME=/project/rcc/pnsinha/XDG_HOME/cache | |
| export XDG_CONFIG_HOME=${HOME}/.config | |
| export XDG_DATA_HOME=${HOME}/.local/share | |
| export XDG_STATE_HOME=${HOME}/.local/state | |
| ############################################################################### | |
| # Basic environment setup | |
| ############################################################################### | |
| PATH="$PATH:$HOME/bin" | |
| export PATH | |
| export TMPDIR=/tmp/$USER | |
| export TMP=/tmp/$USER | |
| mkdir -p $TMPDIR | |
| ############################################################################### | |
| # Bash completion setup | |
| ############################################################################### | |
| # Enable programmable completion features | |
| if ! shopt -oq posix; then | |
| if [ -f /usr/share/bash-completion/bash_completion ]; then | |
| . /usr/share/bash-completion/bash_completion | |
| elif [ -f /etc/bash_completion ]; then | |
| . /etc/bash_completion | |
| fi | |
| fi | |
| # Load custom completions from user directory | |
| if [ -d "$XDG_CONFIG_HOME/bash_completion.d" ]; then | |
| for completion in "$XDG_CONFIG_HOME/bash_completion.d/"*; do | |
| [[ -f $completion ]] && source "$completion" | |
| done | |
| fi | |
| ############################################################################### | |
| # Interactive shell configurations | |
| ############################################################################### | |
| export VSCODE_CLI_DATA_DIR=$TMPDIR | |
| # Shell options | |
| shopt -s checkwinsize # Update window size after each command | |
| shopt -s histappend # Append to history instead of overwriting | |
| shopt -s cmdhist # Save multi-line commands as one command | |
| shopt -s globstar # Enable ** recursive glob | |
| shopt -s autocd # Change directory by typing directory name | |
| # History settings | |
| HISTCONTROL=ignoreboth:erasedups # Ignore duplicates and commands starting with space | |
| HISTSIZE=10000 | |
| HISTFILESIZE=20000 | |
| HISTFILE="$XDG_STATE_HOME/bash_history" | |
| # Aliases | |
| alias ebsh="source /software/easybuild/ebtcl.sh && ml EasyBuild/4.9.4" | |
| alias spacksh="source /software/sw/spack-mw3/spack/share/spack/setup-env.sh" | |
| alias sp="source $HOME/.bashrc.d/.socksproxy" | |
| alias als="source $HOME/.bashrc.d/alias" | |
| alias eza="eza --icons --group-directories-first" | |
| alias ls="eza --icons --group-directories-first" | |
| alias slurmals="source $HOME/.bashrc.d/slurmalias.sh" | |
| alias lint="source $HOME/.bashrc.d/alias && lint" | |
| # SLURM interactive session aliases | |
| alias sintbg="sinteractive -A rcc-staff --partition=gpu -c12 --gres=gpu:1 --qos=gpu" | |
| alias sintb="sinteractive -A rcc-staff --partition=build -c8 -t05:00:00" | |
| ############################################################################### | |
| # Tool-specific configurations and completions | |
| ############################################################################### | |
| # Cargo (Rust) | |
| source "$XDG_DATA_HOME/cargo/env" | |
| # Atuin (Shell history) | |
| eval "$(atuin init bash --disable-up-arrow)" | |
| # FZF (Fuzzy finder) | |
| [ -f "${XDG_CONFIG_HOME}/fzf/fzf.bash" ] && source "${XDG_CONFIG_HOME}/fzf/fzf.bash" | |
| # Spack completion | |
| [ -f "/software/sw/spack-mw3/spack/share/spack/bash/spack-completion.bash" ] && \ | |
| source /software/sw/spack-mw3/spack/share/spack/bash/spack-completion.bash | |
| ############################################################################### | |
| # Utility functions | |
| ############################################################################### | |
| function update_job() { | |
| local job_id=$1 | |
| local time=$2 | |
| scontrol update jobid=$job_id TimeLimit=$time | |
| } | |
| ############################################################################### | |
| # Environment variables | |
| ############################################################################### | |
| #export MLFLOW_TRACKING_USERNAME= | |
| export NP_LOCATION=/project/rcc/pnsinha/nix | |
| export PATH=$HOME/.nami/bin:$PATH | |
| export TERMINFO=~/.local/share/terminfo | |
| #ml singularity | |
| BINDIR="${XDG_BIN_HOME:-$HOME/.local/bin}" | |
| if ! echo $PATH | grep "$BINDIR" >/dev/null 2>&1; then | |
| export PATH="$PATH:$BINDIR" | |
| fi | |
| . "$HOME/.local/share/../bin/env" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment