#! /bin/tcsh -f # {{{ Versioning and license info # # $Id: setup,v 1.13 2006/08/21 15:55:14 proclus Exp $ # Many thanks to Robert L. Campbell # Copyright (C) 2006 Michael L. Love # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # or find it at: http://www.gnu.org/copyleft/gpl.html # # }}} # {{{ Script identity variables setenv scriptName my_setup setenv scriptVersion 1.7.4 setenv scriptMaintainer proclus@gnu-darwin.org # }}} # {{{ proto-ANSI definitions setenv BOLD "" setenv UNBOLD "" setenv PREMARK "[01;" setenv POSTMARK "m" setenv UNMARK "" # cleanup ansi here ;-} # setenv UNMARK "" setenv UNMARK "" setenv UNMARK "" setenv UNMARK "" setenv LTGREY ${PREMARK}0${POSTMARK} setenv UNLTGREY ${UNMARK} setenv UNDERLINE ${PREMARK}4${POSTMARK} setenv UNUNDERLINE ${UNMARK} setenv BLOCK ${PREMARK}7${POSTMARK} setenv UNBLOCK ${UNMARK} setenv GREY ${PREMARK}30${POSTMARK} setenv UNGREY ${UNMARK} setenv YELLOW ${PREMARK}33${POSTMARK} setenv UNYELLOW ${UNMARK} setenv GREEN ${PREMARK}32${POSTMARK} setenv UNGREEN ${UNMARK} setenv BLUE ${PREMARK}34${POSTMARK} setenv UNBLUE ${UNMARK} setenv CYAN ${PREMARK}36${POSTMARK} setenv UNCYAN ${UNMARK} setenv RED ${PREMARK}31${POSTMARK} setenv UNRED ${UNMARK} setenv MAGENTA ${PREMARK}35${POSTMARK} setenv UNMAGENTA ${UNMARK} setenv WHITE ${PREMARK}37${POSTMARK} setenv UNWHITE ${UNMARK} setenv BLOCKGREY ${PREMARK}5${POSTMARK} setenv UNBLOCKGREY ${UNMARK} setenv BLOCKYELLOW ${PREMARK}43${POSTMARK} setenv UNBLOCKYELLOW ${UNMARK} setenv BLOCKGREEN ${PREMARK}42${POSTMARK} setenv UNBLOCKGREEN ${UNMARK} setenv BLOCKBLUE ${PREMARK}44${POSTMARK} setenv UNBLOCKBLUE ${UNMARK} setenv BLOCKCYAN ${PREMARK}46${POSTMARK} setenv UNBLOCKCYAN ${UNMARK} setenv BLOCKRED ${PREMARK}41${POSTMARK} setenv UNBLOCKRED ${UNMARK} setenv BLOCKMAGENTA ${PREMARK}45${POSTMARK} setenv UNBLOCKMAGENTA ${UNMARK} setenv BLOCKWHITE ${PREMARK}47${POSTMARK} setenv UNBLOCKWHITE ${UNMARK} # }}} # {{{ IO control variables # This only works with GNU/Linux to my knowledge # but it can probably be coded in without using the variables. # run quietly, but show errors. setenv runQuiet "> /dev/null" # run very quietly sending errors to /dev/null too. setenv runVeryQuiet ">& /dev/null" # a third option to display stdio but not stderr # run so... ( command > /dev/tty ) ${runVeryQuiet} # }}} # {{{ Time and Host stamps # Each of these have various advantages and limitations, # and they should probably be adapted to the situation. # serial host and date stamp setenv DATESTAMP `( echo -n ${HOST}"." && date ) | awk '{print($1$2$3$4)}' | sed s/':'//g` # small random number setenv SHORTSTAMP `( echo -n ${HOST}"." && date +%N ) | sum | awk '{print($1)}'` # larger semi-random number setenv LSSHORTSTAMP `( echo -n ${HOST}"." && date +%N ) | sed s/'000$'//` # }}} # {{{ Set some basic/general values # determine operating system (architecture) setenv OS `uname -s` setenv OS_VERSION `uname -r` setenv MACHINE `uname -m` if ( -f /etc/debian_version ) then setenv DISTRO Debian else if ( -f /etc/fedora-release ) then setenv DISTRO FedoraCore else setenv DISTRO endif # make some big programs run better! if ( ${OS} != 'Darwin' && ${OS_VERSION} != '7.0.0' ) then unlimit stacksize limit coredumpsize 0 endif # }}} # {{{ Handle arguments #switch ($#argv) #case 0: # {{{ No argument given? # # echo put usage info here # # breaksw # }}} #default: #@ i = 0 #while (1) # #setenv word $i #echo ${PREMARK}${i}${POSTMARK}${i}${UNMARK} # #@ i = $i + 1 #end # #echo # #endsw echo echo Welcome to ${GREEN}${scriptName}-${scriptVersion}${UNGREEN} echo echo "Your OS is: ${CYAN}${DISTRO}${UNCYAN} " echo " ${BLUE}${OS}${UNBLUE} " echo " ${MAGENTA}${OS_VERSION}${UNMAGENTA} " echo " ${RED}${MACHINE}${UNRED} " echo " ${WHITE}Hello World\!${UNWHITE} " echo echo $LTGREY LTGREY $UNLTGREY $UNDERLINE UNDERLINE $UNUNDERLINE echo $GREY GREY $UNGREY$YELLOW YELLOW $UNYELLOW $GREEN GREEN $UNGREEN echo $BLOCKGREY BLOCKGREY $UNBLOCKGREY$BLOCKYELLOW BLOCKYELLOW $UNBLOCKYELLOW$BLOCKGREEN BLOCKGREEN $UNBLOCKGREEN echo $BLUE BLUE $UNBLUE $CYAN CYAN $UNCYAN $RED RED $UNRED $MAGENTA MAGENTA $UNMAGENTA $WHITE WHITE $UNWHITE echo $BLOCKBLUE BLOCKBLUE $UNBLOCKBLUE$BLOCKCYAN BLOCKCYAN $UNBLOCKCYAN$BLOCKRED BLOCKRED $UNBLOCKRED$BLOCKMAGENTA BLOCKMAGENTA $UNBLOCKMAGENTA$BLOCK BLOCK $UNBLOCK$BLOCKWHITE BLOCKWHITE $UNBLOCKWHITE echo echo $scriptMaintainer": all suggestions welcome" echo