#-------------------------------------shell-------------------------------------
PS1='$PWD> ' # prompt showing current directory
PATH=$PATH':whatever' # append to path
cd - # previous directory
#-------------------------------------date-------------------------------------
date -v-7H "+%A %l:%M:%S %p, %Y-%m-%d" # Friday 3:59:50 PM, 2003-09-12 ( -7 hours from GMT specified )
date +"%Y-%m-%d-%H-%M" # 2005-11-09-13-19
#-------------------------------------tar-------------------------------------
# tar -c create, -x extract, -f file, -v verbose
tgz: tar -cvf - $* | gzip > my.tgz # "-" alone important
untgz: gunzip -c my.tgz | tar -xvf -
#-------------------------------------scripts-------------------------------------
for ((x=1;x<20000;x++)); do clear; ls -al; sleep 5; done # for (c-style) loop
for i in $* ; do echo $i; done; # for-in loop; all ARGV command line arguments
#-------------------------------------strings-------------------------------------
echo "Make LOWERCASE" | tr A-Z a-z # convert from uppercase to lowercase
ls -w | sed s/www.robertbody.com./RB:/ # replace "www...com" with "RB:"
#-------------------------------------scripts-------------------------------------
tail -200 file* | grep -B1 redirect
ls -w | sed s/www.robertbody.com./RB:/
for i in $* ; do
if [ -a $i ]; then # if file exists (specified as parameters)
echo "$H $i <-- ok";
else
echo "$H $i <-- does not exist"; allFound=0;
fi;
done;
#-------------------------------login script example------------------------------
/www/robertbody/robertbody.com> cat r
echo "...robertbody setup..."
echo " PS1='\$PWD> '"
echo " MYBIN=/www/robertbody/robertbody.com/cgi-bin/bin"
echo " C=/www/robertbody/robertbody.com/cgi-bin/counter"
echo " PATH=.:\$PATH:\$MYBIN"
echo "......................"
PS1='$PWD> '
MYBIN=/www/robertbody/robertbody.com/cgi-bin/bin
C=/www/robertbody/robertbody.com/cgi-bin/counter
PATH=.:$PATH:$MYBIN
|