#!/bin/tcsh -f if ("$1" == '' || "$1" == '-h' || "$1" == '-help') then goto USAGE endif set Name = $1 set ComCnt = 0 foreach junk ($*) @ ComCnt ++ end set cnt = 2 while ($cnt <= $ComCnt) set ext = $Name:e if ("$ext" == "$argv[$cnt]") then set Name = $Name:r endif @ cnt ++ end echo $Name goto ENDALL USAGE: echo "Usage: `basename $0` ....." echo "example: `basename $0` Hello.HEAD HEAD BRIK" echo "returns Hello" echo "`basename $0` Hello.BRIK HEAD BRIK" echo "returns Hello" echo "`basename $0` Hello.Jon HEAD BRIK" echo "returns Hello.Jon" echo "" echo "Ziad Saad (ziad@nih.gov)" echo "LBC/NIMH/ National Institutes of Health, Bethesda Maryland" echo "" goto ENDALL ENDALL: