#!/bin/csh -f #+ # masknames -- print the name(s) of currently-loaded slitmasks # # Purpose: # With no argument, prints out the names of all currently-loaded # slitmasks as they would appear on the DEIMOS GUI. With # numeric arguments, print out the names of the masks in the # selected positions. # # Usage: # masknames [ .. ] # # Arguments: # posN = position number of the mask [ 2 <= posN <= 12 ] # # Output: # results written to STDOUT # # Restrictions: # None # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # # Example: # 1. Print a list of all currently-loaded masks: # [63] dmoseng@polo> masknames # MSKNAM2 = GOH_X # MSKNAM3 = g1_1 # MSKNAM4 = LongA # MSKNAM5 = 4213.W # MSKNAM6 = 4248.E # MSKNAM7 = 3209.W # MSKNAM8 = 3211.W # MSKNAM9 = 4219.W # MSKNAM10 = CL0024 # MSKNAM11 = rse1 # MSKNAM12 = GOSpH3 # # 2. Print the names of the masks is slots 3 and 7: # [64] dmoseng@polo> masknames 3 7 # MSKNAM3 = g1_1 # MSKNAM7 = 3209.W # # See also: # slitmask #- # Modification history: # 2002-Oct-09 GDW Original version #----------------------------------------------------------------------- set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd [-terse] [pos1 .. posN]" set positions = (2 3 4 5 6 7 8 9 10 11 12) set inventory = $KROOT/data/deimot/dyna/inventory set unknown = INDEF set verb = 1 # parse flags... while ( $#argv > 0 ) # check for nofcs flag... if ( "$1" == "-terse" ) then set verb = 0 shift continue endif # no flags found; so quit processing flags... break end # parse args... if ( $#argv > 0 ) then set positions = ($*) endif # loop over positions... foreach pos ( $positions ) set keyword = MSKBAR$pos set barcode = `show -s deimot -terse $keyword` set name = `awk '/^#/{next}$1=="S" && $3=="'${barcode}'"{print $2;exit}' $inventory` if ( "$name" == "" ) then set name = $unknown endif if ( $verb ) then printf "%12s = " "MSKNAM$pos" endif printf "%s\n" $name end exit