Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
bash [2008/11/17 21:27] a created |
bash [2009/05/25 00:35] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | If you just want to find out what's new in a directory: | + | ===== .barshrc ===== |
| + | |||
| + | <code |f .barshrc> | ||
| + | |||
| + | function os { | ||
| + | export OPER_SYS_1=" | ||
| + | export OPER_SYS_2=" | ||
| + | export KERN_INFO=" | ||
| + | echo -ne " | ||
| + | echo -e " | ||
| + | } | ||
| + | |||
| + | function hw () { | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | echo -e " | ||
| + | echo " * Motherboard:" | ||
| + | echo " * Manufacturer: | ||
| + | echo " * Model: $MOBO_MOD" | ||
| + | echo " * CPU(s):" | ||
| + | echo " | ||
| + | echo " * Total RAM: $(($RAM_TOTAL_KB / 1024)) MB" | ||
| + | echo " * HDD info: " | ||
| + | echo " | ||
| + | | ||
| + | </ | ||
| + | |||
| + | alias system=" | ||
| + | |||
| + | **Colored prompt** | ||
| + | <code bash|> | ||
| + | PS1=' | ||
| + | </ | ||
| + | |||
| + | ==== Adds date/time to history ==== | ||
| + | #vi $HOME/ | ||
| + | export HISTTIMEFORMAT=”%h/ | ||
| + | |||
| + | ==== If you just want to find out what's new in a directory | ||
| + | |||
| + | | ||
| + | |||
| + | ===== Scripts ===== | ||
| + | ==== Diff Two Directories ==== | ||
| + | |||
| + | <code bash|f diff2.sh> | ||
| + | # | ||
| + | |||
| + | cr=' | ||
| + | if [ -z $3 ]; then cr=$3; fi | ||
| + | |||
| + | for f in `find $1/$3 -type f | sed " | ||
| + | do | ||
| + | printf " | ||
| + | diff $1/$f $2/$f | sed -e " | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | ===== Bash misc stuff ===== | ||
| + | ==== $RANDOM not random at all ==== | ||
| + | |||
| + | instead of $RANDOM use .. | ||
| + | SEED=$(head -c4 / | ||
| + | ((N=SEED%N)) | ||
| + | or | ||
| + | |||
| + | SEED=$(head -1 / | ||
| + | ((N=SEED%N)) | ||
| + | |||
| - | lsnew() { ls -lt ${1+" | ||

