Differences

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

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
bash [2008/11/17 21:27]
a created
bash [2009/01/13 14:19]
a
Line 1: Line 1:
 If you just want to find out what's new in a directory: If you just want to find out what's new in a directory:
  
-lsnew() { ls -lt ${1+"$@"} | head -20; }+   lsnew() { ls -lt ${1+"$@"} | head -20; } 
 + 
 +**.barshrc** 
 + 
 +<code |f .barshrc> 
 + 
 +function os { 
 +      export OPER_SYS_1="`uname -s`" 
 +      export OPER_SYS_2="`cat /etc/issue | head -n 1`" 
 +      export KERN_INFO="`uname -r`" 
 +      echo -ne "\033[31mOS:\033[0m " &amp;&amp; echo "$OPER_SYS_1, $OPER_SYS_2" 
 +      echo -e "\033[32mKernel:\033[0m $KERN_INFO" 
 +      } 
 + 
 +function hw () { 
 +   export MOBO_MAN="`sudo dmidecode --type baseboard | grep 'Manufacturer' | cut -d' ' -f2-`" 
 +   export MOBO_MOD="`sudo dmidecode --type baseboard | grep 'Product' | cut -d' ' -f3-`" 
 +   export CPU="`cat /proc/cpuinfo | grep 'model name' | cut -d' ' -f3-`" 
 +   export RAM_TOTAL_KB="`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`" 
 +   export HDD_INFO="`sudo fdisk -l | grep Disk | grep -v identifier`" 
 +   echo -e "\033[1;34mHardware\033[0m:" 
 +   echo " * Motherboard:" 
 +   echo " * Manufacturer: $MOBO_MAN" 
 +   echo " * Model: $MOBO_MOD" 
 +   echo " * CPU(s):" 
 +   echo "$CPU" 
 +   echo " * Total RAM: $(($RAM_TOTAL_KB / 1024)) MB" 
 +   echo " * HDD info: " 
 +   echo "$HDD_INFO" 
 +   echo 
 +</code> 
 + 
 +    alias system="os &amp;&amp; hw" 
 + 
 +===== 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 "s|$1/||"
 +do 
 +  printf "===!%-76s" "$f!" | tr ' !' '= '; echo 
 +  diff $1/$f $2/$f | sed -e "s/^</$1: /" -e "s/^>/$2: /" 
 +done 
 +</code> 
bash.txt · Last modified: 2009/05/25 00:35 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 ipv6 ready