Différences entre les versions de « Exemples de .bashrc »
De Wikip
toross>WikiAdmin  | 
				m (1 version importée)  | 
				||
| (2 versions intermédiaires par 2 utilisateurs non affichées) | |||
| Ligne 13 : | Ligne 13 : | ||
{{parW|1=  | {{parW|1=  | ||
* Lire [[SSH#sshAgentPb]]  | * Lire [[SSH#sshAgentPb]]  | ||
}}  | |||
= Pattern =  | |||
{{parW|1=  | |||
{{code|lang=bash|code=  | |||
################################################################################  | |||
function pause(){  | |||
 read -s -n 1 -p "Press any key to continue …"  | |||
 echo ""  | |||
}  | |||
################################################################################  | |||
genDir=gen  | |||
drvDir=$genDir/drv  | |||
if [ ! -d $genDir ]; then  | |||
    echo "the directory '$genDir' does not exist, we create it."  | |||
    mkdir $genDir  | |||
fi  | |||
################################################################################  | |||
rc=$?  | |||
if [ ! $rc -eq 0 ]; then  | |||
    echo "ERRORS we mus stop"  | |||
    exit 1  | |||
fi  | |||
################################################################################  | |||
}}  | |||
}}  | }}  | ||
= .bashrc l'exemple =  | = .bashrc l'exemple =  | ||
{{parW|1=  | {{parW|1=  | ||
{{code|lang=bash  | ☞ voir la référence en priorité   | ||
* {{m|https://atoross@at.bht.fr/git/bashTool.git}}  | |||
{{code|lang=bash|code=  | |||
#!/bin/bash  | #!/bin/bash  | ||
###############################################################################  | |||
#   | ################################################################################  | ||
###############################################################################  | # LANGUAGE  | ||
###############################################################################  | ################################################################################  | ||
#   | export LC_ALL=en_US.UTF-8  | ||
###############################################################################  | export LANG=en_US.UTF-8  | ||
export LANGUAGE=en_US.UTF-8  | |||
################################################################################  | |||
# programming  | |||
################################################################################  | |||
export CPPFLAGS=  | export CPPFLAGS=  | ||
export CXXFLAGS=  | export CXXFLAGS=  | ||
export LDFLAGS=  | export LDFLAGS=  | ||
export LD_LIBRARY_PATH=  | export LD_LIBRARY_PATH=  | ||
################################################################################  | |||
# set_paths  | |||
################################################################################  | |||
set_paths64()  | set_paths64()  | ||
{  | {  | ||
| Ligne 48 : | Ligne 83 : | ||
export PATH="$APP_DIR/bin:$PATH"  | export PATH="$APP_DIR/bin:$PATH"  | ||
}  | }  | ||
###############################################################################  | ################################################################################  | ||
# Examples :  | # Examples :  | ||
# set_paths /local00/home/C07138/exe/gmp  | # set_paths /local00/home/C07138/exe/gmp  | ||
| Ligne 55 : | Ligne 90 : | ||
# set_paths64 /local00/home/C07138/exe/gcc  | # set_paths64 /local00/home/C07138/exe/gcc  | ||
# set_paths /local00/home/C07138/exe/scilab /scilab  | # set_paths /local00/home/C07138/exe/scilab /scilab  | ||
###############################################################################  | ################################################################################  | ||
################################################################################  | |||
# Subversion  | # Subversion  | ||
###############################################################################  | ################################################################################  | ||
alias svs='svn status -q'  | alias svs='svn status -q'  | ||
alias scm='svn commit -m '  | alias scm='svn commit -m '  | ||
alias spl='svn update '  | alias spl='svn update '  | ||
alias spu='svn commit -m '  | alias spu='svn commit -m '  | ||
###############################################################################  | |||
################################################################################  | |||
# Git  | # Git  | ||
###############################################################################  | ################################################################################  | ||
alias gsha='git show -s --format=%H'    | alias gsha='git show -s --format=%H'  | ||
alias gssha='git show -s --format=%h'  | alias gssha='git show -s --format=%h'  | ||
alias lt='ls -lart'  | alias lt='ls -lart'  | ||
| Ligne 98 : | Ligne 136 : | ||
alias gplb='git pull bht '  | alias gplb='git pull bht '  | ||
alias gsav='git add -u; git commit -m "save" ; git push '  | alias gsav='git add -u; git commit -m "save" ; git push '  | ||
###############################################################################  | alias gcleanwhitespaces='sed -i -e "s/[[:blank:]]*$//g" '  | ||
################################################################################  | |||
# Python  | # Python  | ||
###############################################################################  | ################################################################################  | ||
pyclean () {  | pyclean () {  | ||
         find . -type f -name "*.py[co]" -delete  |          find . -type f -name "*.py[co]" -delete  | ||
         find . -type d -name "__pycache__" -delete  |          find . -type d -name "__pycache__" -delete  | ||
}  | }  | ||
###############################################################################  | |||
################################################################################  | |||
# apt/apt-get  | # apt/apt-get  | ||
###############################################################################  | ################################################################################  | ||
alias apti='apt install'  | alias apti='apt install'  | ||
alias apts='apt.cache search'  | alias apts='apt.cache search'  | ||
alias aptg='apt-get'  | alias aptg='apt-get'  | ||
alias aptgi='apt-get install'  | alias aptgi='apt-get install'  | ||
###############################################################################  | |||
################################################################################  | |||
# ls  | # ls  | ||
###############################################################################  | ################################################################################  | ||
export LS_OPTIONS='--color=auto'  | export LS_OPTIONS='--color=auto'  | ||
eval "`dircolors`"  | eval "`dircolors`"  | ||
#-------------------------------------------------------------------------------  | |||
alias ls='ls -  | alias ls='ls -1BhqQ $LS_OPTIONS'  | ||
alias ll='ls -  | alias ll='ls -l --time-style=full-iso'  | ||
alias lt='ls -  | alias lt='ll -rt'  | ||
alias   | alias lsd0='\ls -1Bhqd $LS_OPTIONS */'  | ||
alias lsd='lsd0 | sed "s/.$//" | while read x ; do echo -e "\e[1;34m$x\e[0m" ; \  | |||
done'  | |||
alias ltd='lsd0 -rt | sed "s/.$//" | while read x ; do echo -e "\e[1;34m$x\e[0m\  | |||
" ; done'  | |||
################################################################################  | |||
# rm cp mv diff emacs  | |||
################################################################################  | |||
alias rm='rm -i'  | alias rm='rm -i'  | ||
alias cp='cp -i'  | alias cp='cp -i'  | ||
| Ligne 127 : | Ligne 177 : | ||
alias diff='diff -BrqZE'  | alias diff='diff -BrqZE'  | ||
alias emacs='emacs -nw'  | alias emacs='emacs -nw'  | ||
###############################################################################  | |||
################################################################################  | |||
# disk  | # disk  | ||
###############################################################################  | ################################################################################  | ||
alias lsblkOld='lsblk -o mountpoint,kname,name,label,fstype,UUID,size,FSSIZE,\  | alias lsblkOld='lsblk -o mountpoint,kname,name,label,fstype,UUID,size,FSSIZE,\  | ||
FSUSED'  | FSUSED'  | ||
alias lsblk='lsblk -o mountpoint,name,label,partlabel,size,  | alias lsblk='lsblk -o mountpoint,kname,name,label,partlabel,fstype,size,fssize,\  | ||
fsused,fsuse%'  | |||
alias lsblkUuid='lsblk -o mountpoint,name,uuid,partlabel,fstype'  | alias lsblkUuid='lsblk -o mountpoint,name,uuid,partlabel,fstype'  | ||
alias blkid='sudo blkid -u filesystem'  | alias blkid='sudo blkid -u filesystem'  | ||
# umask u=rwx,g=rwx,o=  | # umask u=rwx,g=rwx,o=  | ||
###############################################################################  | |||
################################################################################  | |||
# slurm  | # slurm  | ||
###############################################################################  | ################################################################################  | ||
alias jobInf='sacct  --format submit,user%-6,jobId%-15,Elapsed%-10,State%+20,  | alias jobInf='sacct  --format submit,user%-6,jobId%-15,Elapsed%-10,State%+20,Wo\  | ||
alias jobInf2='sacct  --format submit,user%-6,jobId%-15,Elapsed%-10,State%+20,  | rkDir%-40'  | ||
alias jobInf2='sacct  --format submit,user%-6,jobId%-15,Elapsed%-10,State%+20,W\  | |||
orkDir%-40 -S  2020-01-01'  | |||
alias jobRun='squeue --format "%A %D-%C %T %L %M %Z"'  | alias jobRun='squeue --format "%A %D-%C %T %L %M %Z"'  | ||
###############################################################################  | |||
################################################################################  | |||
# bash  | # bash  | ||
###############################################################################  | ################################################################################  | ||
if [ -f /etc/bash_completion ]; then  | if [ -f /etc/bash_completion ]; then  | ||
  . /etc/bash_completion  |   . /etc/bash_completion  | ||
| Ligne 155 : | Ligne 211 : | ||
fi  | fi  | ||
}  | }  | ||
# export PS1='\u@\h:\w$(gitCurBranch)\$'    | # export PS1='\u@\h:\w$(gitCurBranch)\$'  | ||
export PS1='\[\033[0;92m\]\u\[\033[0;35m\]@\[\033[0;92m\]\h\[\033[0;33m\]:\w\  | export PS1='\[\033[0;92m\]\u\[\033[0;35m\]@\[\033[0;92m\]\h\[\033[0;33m\]:\w\  | ||
\[\033[0;36m\]$(gitCurBranch)\[\033[0;39m\]\$'  | \[\033[0;36m\]$(gitCurBranch)\[\033[0;39m\]\$'  | ||
###############################################################################  | ################################################################################  | ||
# proxy  | |||
################################################################################  | |||
export http_proxy=http://C07138@vip-users.proxy.edf.fr:3131  | |||
export https_proxy=http://C07138@vip-users.proxy.edf.fr:3131  | |||
export ftp_proxy=http://C07138@vip-users.proxy.edf.fr:3131  | |||
export no_proxy=".edf.fr,localhost,127.0.0.1"  | |||
################################################################################  | |||
# msys  | |||
################################################################################  | |||
export PATH=/c/p/pf/msys64/mingw64/bin:$PATH  | |||
################################################################################  | |||
}}  | }}  | ||
}}  | }}  | ||
Version actuelle datée du 18 décembre 2024 à 13:07
1 Référence
2 Sous windows avec cygween ou msys2 comment activer ssh-agent
- Lire SSH#sshAgentPb
 
3 Pattern
################################################################################
function pause(){
 read -s -n 1 -p "Press any key to continue …"
 echo ""
}
################################################################################
genDir=gen
drvDir=$genDir/drv
if [ ! -d $genDir ]; then
    echo "the directory '$genDir' does not exist, we create it."
    mkdir $genDir
fi
################################################################################
rc=$?
if [ ! $rc -eq 0 ]; then
    echo "ERRORS we mus stop"
    exit 1
fi
################################################################################
4 .bashrc l'exemple
☞ voir la référence en priorité
#!/bin/bash
################################################################################
# LANGUAGE
################################################################################
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
################################################################################
# programming
################################################################################
export CPPFLAGS=
export CXXFLAGS=
export LDFLAGS=
export LD_LIBRARY_PATH=
################################################################################
# set_paths
################################################################################
set_paths64()
{
APP_DIR=$1
LIB_DIR=$2
export CPPFLAGS="-I$APP_DIR/include $CPPFLAGS"
export CXXFLAGS="-I$APP_DIR/include $CXXFLAGS"
export LDFLAGS="-L$APP_DIR/lib64$LIB_DIR $LDFLAGS"
export LD_LIBRARY_PATH="$APP_DIR/lib64$LIB_DIR:$LD_LIBRARY_PATH"
export PATH="$APP_DIR/bin:$PATH"
}
set_paths()
{
APP_DIR=$1
LIB_DIR=$2
export CPPFLAGS="-I$APP_DIR/include $CPPFLAGS"
export CXXFLAGS="-I$APP_DIR/include $CXXFLAGS"
export LDFLAGS="-L$APP_DIR/lib$LIB_DIR $LDFLAGS"
export LD_LIBRARY_PATH="$APP_DIR/lib$LIB_DIR:$LD_LIBRARY_PATH"
export PATH="$APP_DIR/bin:$PATH"
}
################################################################################
# Examples :
# set_paths /local00/home/C07138/exe/gmp
# set_paths /local00/home/C07138/exe/mpfr
# set_paths /local00/home/C07138/exe/mpc
# set_paths64 /local00/home/C07138/exe/gcc
# set_paths /local00/home/C07138/exe/scilab /scilab
################################################################################
################################################################################
# Subversion
################################################################################
alias svs='svn status -q'
alias scm='svn commit -m '
alias spl='svn update '
alias spu='svn commit -m '
################################################################################
# Git
################################################################################
alias gsha='git show -s --format=%H'
alias gssha='git show -s --format=%h'
alias lt='ls -lart'
alias gad='git add '
alias gbr='git branch '
alias grp='git rev-parse '
alias gcb='git rev-parse --abbrev-ref HEAD'
alias gcs='git rev-parse $(gcb)'
alias gcm='git commit -m '
alias gco='git checkout '
alias gcur='git symbolic-ref --short HEAD'
alias gltag='git describe --exact-match --abbrev=0'
alias gpl='git pull '
alias gpu='git push '
alias glg='git log --pretty=format:"%h %cd %cn %Cgreen%s %Cred%d" --graph  \
--abbrev-commit --date="format:%Y/%m/%d %Hh%M"'
alias gslg='git log --pretty=format:"%h %cd %Cgreen%s %Cred%d" --graph  \
--abbrev-commit  --date="format:%Y/%m/%d %Hh%M"'
alias gst='git status '
alias gsu='git status -uno '
alias gsw='git checkout '
alias gdif='git diff -w  '
alias gdifn='git diff -w --name-only '
alias grv='git remote -v '
alias gra='git remote add '
alias gme='git merge --no-ff --no-commit'
alias gpuo='git push origin '
alias gplo='git pull origin '
alias gpua='git push at64g '
alias gpla='git pull at64g '
alias gpub='git push bht '
alias gplb='git pull bht '
alias gsav='git add -u; git commit -m "save" ; git push '
alias gcleanwhitespaces='sed -i -e "s/[[:blank:]]*$//g" '
################################################################################
# Python
################################################################################
pyclean () {
        find . -type f -name "*.py[co]" -delete
        find . -type d -name "__pycache__" -delete
}
################################################################################
# apt/apt-get
################################################################################
alias apti='apt install'
alias apts='apt.cache search'
alias aptg='apt-get'
alias aptgi='apt-get install'
################################################################################
# ls
################################################################################
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
#-------------------------------------------------------------------------------
alias ls='ls -1BhqQ $LS_OPTIONS'
alias ll='ls -l --time-style=full-iso'
alias lt='ll -rt'
alias lsd0='\ls -1Bhqd $LS_OPTIONS */'
alias lsd='lsd0