Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bash [2009/01/13 14:19]
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+"$@"} | head -20; } +
- +
-**.barshrc**+
  
 <code |f .barshrc> <code |f .barshrc>
Line 34: Line 30:
  
     alias system="os &amp;&amp; hw"     alias system="os &amp;&amp; hw"
 +
 +**Colored prompt**
 +<code bash|>
 +PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 +</code>
 +
 +==== Adds date/time to history ====
 +  #vi $HOME/.bashrc
 +  export HISTTIMEFORMAT=”%h/%d - %H:%M:%S “
 +
 +==== If you just want to find out what's new in a directory ====
 +
 +   lsnew() { ls -lt ${1+"$@"} | head -20; }
  
 ===== Scripts ===== ===== Scripts =====
Line 50: Line 59:
 done done
 </code> </code>
 +
 +===== Bash misc stuff =====
 +==== $RANDOM not random at all ====
 +
 +instead of $RANDOM use ..
 +  SEED=$(head -c4 /dev/urandom | od -t u4 | awk '{ print $2 }')
 +  ((N=SEED%N))
 +or
 +
 +  SEED=$(head -1 /dev/urandom | od -N 1 | awk '{ print $2 }'
 +  ((N=SEED%N))
 +
 +
  
bash.1231852740.txt.gz · Last modified: 2009/05/25 00:34 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready