Aliases and local variables: Difference between revisions

From HPCwiki
Jump to navigation Jump to search
(Created page with " * motivation for aliases and variables * ===Example ~/.bash_aliases=== ‎<pre> #!/bin/bash #Define editor editor='nano' #or vim # Bash files commands alias ebc="${editor} ${HOME}/.bashrc" alias sbc="source ${HOME}/.bashrc" alias eba="${editor} ${HOME}/.bash_aliases" alias sba="source ${HOME}/.bash_aliases" # ls aliases alias ll="ls -alth" alias sl='ls' #location variables export mySCRATCH=/lustre/scratch/GUESTS/$USER export myBKP=/lustre/backup/GUESTS/$USER expor...")
 
No edit summary
 
Line 1: Line 1:
'''DRAFT'''


* motivation for aliases and variables
* motivation for aliases and variables
*
* Brief explanation of what aliases are
* Some basic commands


===Example ~/.bash_aliases===
===Example ~/.bash_aliases===

Latest revision as of 16:43, 2 December 2024

DRAFT

  • motivation for aliases and variables
  • Brief explanation of what aliases are
  • Some basic commands

Example ~/.bash_aliases

#!/bin/bash
#Define editor

editor='nano' #or vim

# Bash files commands
alias ebc="${editor} ${HOME}/.bashrc"
alias sbc="source ${HOME}/.bashrc"
alias eba="${editor} ${HOME}/.bash_aliases"
alias sba="source ${HOME}/.bash_aliases"

# ls aliases
alias ll="ls -alth"
alias sl='ls'

#location variables
export mySCRATCH=/lustre/scratch/GUESTS/$USER
export myBKP=/lustre/backup/GUESTS/$USER
export myNBKP=/lustre/nobackup/GUESTS/$USER

# 
alias cds="cd $mySCRATCH"
alias cdb="cd $myBKP"
alias cdn="cd $myNBKP"
‎


In order to make this effective, make sure that the following lines are in your ~/.bashrc

if [ -f ~/.bash_aliases ]; then
        . ~/.bash_aliases
fi