Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
bash [2009/01/05 19:35] a |
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 ===== |
| - | lsnew() { ls -lt ${1+" | + | < |
| - | **.barshrc** | ||
| - | |||
| - | <code bash|> | ||
| function os { | function os { | ||
| export OPER_SYS_1=" | export OPER_SYS_1=" | ||
| Line 13: | Line 10: | ||
| echo -e " | echo -e " | ||
| } | } | ||
| - | </ | ||
| - | <code bash|> | ||
| function hw () { | function hw () { | ||
| | | ||
| Line 35: | Line 30: | ||
| alias system=" | 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> | ||
| + | #!/bin/bash | ||
| + | |||
| + | 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)) | ||
| + | |||
| + | |||
| + | |||

