Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Saturday, April 9, 2011

Arrange bashrc

A simple recursive function can have aid on arranging bashrc files in a clear structure.



Add a line to source it in ~/.bashrc first, and then collect similar rc files into directories respectively.

If a bunch of bash completions were put inside ~/.bash_completion/, like
~/.bash_completion
|-- hg
|-- git
| |-- git
| |-- gitk
| `-- git-common
`-- svk
just one more line
  load $HOME/.bash_completion
would load whole completions.

You may also have many aliases, environment variables, function definitions for different OS like this
~/.bashrc.d
|-- linux
| |-- aliases
| |-- env
| `-- functions
|-- freebsd
| |-- aliases
| |-- env
| `-- functions
`-- darwin
|-- aliases
|-- env
`-- functions

Just one another line
  load "$HOME/.bashrc.d/$(lower $(uname))"
can load correct system-specified rc files.

Monday, March 2, 2009

two pragmatic commands

$ cp /some/path/to/myfile{,.back} # cp-the-file

$ mv filename.{old,new} # quickly-rename-a-file


 

Wednesday, August 6, 2008

ls_color in bsd style

for xterm-color, set in .profile

alias ls="ls -G"
export LSCOLORS="ExFxCxDxBxEGEDABAGACAD"

make it more beautiful.