#! /bin/csh -f set sunum = $1 set recnum = `echo "select recnum from hmi_ground.lev0 where sunum = $1;\q" | psql -h hmidb.stanford.edu jsoc | head -3 | tail -1` echo $recnum