# # file: .bashrc # created: pasha jul 8 2007 # modified: pasha nov 15,17-18 2024 # modification: - rearranged linux-gnu # - tab completion for acrobat # - removed manually compiled xpdf # function path_add_if_exists () { if [ -d $1 ]; then PATH=${PATH}:$1 fi } function manpath_add_if_exists () { if [ -d $1 ]; then MANPATH=${MANPATH}:$1 fi } if [ $OSTYPE == cygwin ]; then ##################################################### # # # cygwin (max-und-moritz and brnensky-raj) # # # ##################################################### # despite /bin and /usr/bin are physically the same on cygwin, # /usr/bin should be present in PATH (i.e. just /bin is not enough), # otherwise some things (e.g., compiler toolchain) will brake # /usr/sbin is not needed? PATH=/usr/local/bin:/usr/bin # add windoze stuff #for d in Windows/System32 "Program Files/DjVuLibre"; do for d in pack/ffmpeg/bin; do path_add_if_exists /cygdrive/c/$d done unset d ## for execs compiled with mingw (runtime windoze dll's) #PATH=${PATH}:/usr/i686-w64-mingw32/sys-root/mingw/bin MANPATH=/usr/share/man manpath_add_if_exists /usr/local/man manpath_add_if_exists /usr/local/share/man for d in pari; do manpath_add_if_exists /usr/local/${d}/man done if [ -d /usr/local/lib/perl5 ]; then export PERL5LIB=/usr/local/lib/perl5:/usr/local/lib/perl fi # locations of some unix progs not in PATH alias cal='/usr/local/gcal/bin/gcal -s Mon' if [ -d /usr/local/jed ]; then alias jed=/usr/local/jed/bin/jed fi if [ -d /usr/local/LADR-2009-11A ]; then alias prover9=/usr/local/LADR-2009-11A/bin/prover9 alias mace4=/usr/local/LADR-2009-11A/bin/mace4 fi if [ -d /usr/local/manin2 ]; then alias manin=/usr/local/manin2/manin fi # locations of some windoze progs not in PATH if [ -d /cygdrive/c/Program\ Files/DjVuLibre ]; then alias ddjvu="/cygdrive/c/Program\ Files/DjVuLibre/ddjvu.exe" alias djvm="/cygdrive/c/Program\ Files/DjVuLibre/djvm.exe" fi if [ -d /cygdrive/c/pack/sysinternals ]; then alias eject="/cygdrive/c/pack/sysinternals/sync -e d" alias handle=/cygdrive/c/pack/sysinternals/Handle.exe fi if [ -d /cygdrive/c/Program\ Files/Ghostgum ]; then alias gsview="/cygdrive/c/Program\ Files/Ghostgum/gsview/gsview32.exe" fi alias ipconfig=/cygdrive/c/Windows/System32/ipconfig.exe if [ -d /cygdrive/c/Program\ Files/Wolfram\ Research/Mathematica/12.0 ]; then alias mathematica="/cygdrive/c/Program\ Files/Wolfram\ Research/Mathematica/12.0/math.exe" fi alias netsh=/cygdrive/c/Windows/System32/netsh.exe alias netstat=/cygdrive/c/Windows/System32/NETSTAT.EXE if [ -d /cygdrive/c/Program\ Files/K-Lite\ Codec\ Pack ]; then alias play="/cygdrive/c/Program\ Files/K-Lite\ Codec\ Pack/MPC-HC/mpc-hc.exe" fi alias regedit=/cygdrive/c/Windows/regedit.exe alias taskkill=/cygdrive/c/Windows/System32/taskkill.exe alias traceroute=/cygdrive/c/Windows/System32/TRACERT.EXE # do not show '.exe' when using tab autocompletion shopt -s completion_strip_exe # see dmalloc documentation: # http://dmalloc.com/docs/latest/online/dmalloc_4.html#SEC4 # no need for that on macos, as there is a builtin malloc with different # modus operandi, see man guardmalloc function dmalloc { eval `command dmalloc -b $*`; } elif [[ $OSTYPE == darwin17* ]]; then ##################################################### # # # darwin, aka macos (rapunzel) # # # ##################################################### export CPATH=/opt/local/include export LIBRARY_PATH=/opt/local/lib export PERL5LIB=/usr/local/lib/perl5 PATH=/usr/local/bin PATH=${PATH}:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin MANPATH=/opt/local/man:/usr/share/man:/Library/Developer/CommandLineTools/usr/share/man:/opt/local/share/perl5.34/man # see man bash, shell patterns to ignore in tab autocompletion export EXECIGNORE=/opt/local/bin/dvipdfm*:/opt/local/bin/dvipdft:/opt/local/bin/pdflatex-dev:*/bin/perl5*:*/bin/perlbug*:*/bin/perldoc*5*:*/bin/perlivp*:/opt/local/bin/perltex:*/bin/perlthanks*:/usr/bin/timer*:/usr/bin/emacs* # bash from ports, newer than and with some important options missing in the # system one export SHELL=/opt/local/bin/bash export EDITOR=emacs # not to include macos metadata tarballs, see # https://superuser.com/questions/61185/why-do-i-get-files-like-foo-in-my-tarball-on-os-x export COPYFILE_DISABLE=1 alias eject='diskutil eject' alias free='top -l 1 -s 0 | grep PhysMem' alias ldd='otool -L' alias telnet=gtelnet #alias realpath=/opt/local/bin/grealpath # macos: installed pari package, gp in the path # cygwin: no pari package, compiled and installed in /usr/local , invoked # by script setting PATH alias pari=gp # use gnu utilities, not the system ones alias cal='gcal -s Mon' alias sed=gsed alias tar=gnutar elif [[ $OSTYPE == linux-gnu ]]; then ##################################################### # # # linux (wsl in windows 10 on trurl) # # # ##################################################### export HOME=/home/pasha PATH=/usr/bin:/usr/local/bin:/usr/sbin:/usr/local/sbin export PERL5LIB=/usr/local/lib/perl alias cal='/usr/local/gcal/bin/gcal -s Mon' export DISPLAY=:0.0 else echo unsupported system! fi #### common part ###################################### path_add_if_exists ${HOME}/bin export PATH export MANPATH TEXINPUTS=. if [ -d /usr/local/lib/TeX ]; then TEXINPUTS=${TEXINPUTS}:/usr/local/lib/TeX fi # the semicolon at the end says to append the standard directories (texmf, etc.) export TEXINPUTS=${TEXINPUTS}: export CFLAGS="-pipe -O2" export CXXFLAGS="-pipe -O3" export HISTFILESIZE=1200 export HISTSIZE=$HISTFILESIZE #export LC_ALL=POSIX export LC_TIME=POSIX export MANPAGER="less -X -f -P\"line %lt/%L %pt\%\"" export PERLDOC_PAGER=$MANPAGER export PS1="[\u@\h] \W--> " unset MAILCHECK # to disable ctrl-D for shell exit set -o ignoreeof # options and aliases for commands alias bc='bc -lq' alias chrome=browser alias cp='cp -pi' if [ -f /usr/bin/ncftp ]; then alias ftp=ncftp elif [ -f /usr/bin/tftp ]; then alias ftp=tftp fi # starting circa from Fall 2015, grep on max-und-moritz started to recognize # all files as binary alias grep='grep -a' alias mv='mv -i' alias ll='ls -la' alias latr='ls -latr' alias ls='ls -aF' alias less=$MANPAGER alias perlfunc='perldoc -U -f' alias scp='scp -p' #alias trace=strace alias wget='wget --no-check-certificate' # favorite typos alias doff=diff alias layex=latex alias whuch=which alias xdpf=xpdf alias xodf=xpdf alias xdvo=xdvi # tab completion complete -f -o plusdirs -X '!*.dvi' xdvi dvipdf complete -f -o plusdirs -X '!*.pdf' xpdf acrobat complete -f -X '!*.ps' ps2pdf complete -f -o plusdirs -X '!*.tex' latex pdflatex function _timeinplaces () { COMPREPLY=( $(compgen -W '$(timeinplaces --hoftc)' -- "$2") ) } complete -F _timeinplaces timeinplaces # end of .bashrc