#!/bin/bash # --------------------------------------------------------------------------- # # all_switches : Make a list of all switches hat are found in the program # # (.ftn) files of WAVEWATCH III. # # # # use : all_switches # # # # Hendrik L. Tolman # # May 2009 # # # # Copyright 2009 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # # reserved. WAVEWATCH III is a trademark of the NWS. # # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- # # 1. Preparations # # --------------------------------------------------------------------------- # # 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' echo 'Find all switches in WAVEWATCH III' echo '----------------------------------' # 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv main_dir=$WWATCH3_DIR temp_dir=$WWATCH3_TMP source=$WWATCH3_SOURCE list=$WWATCH3_LIST # --------------------------------------------------------------------------- # # 2. Strip all switches from sources # # --------------------------------------------------------------------------- # cd $main_dir/ftn all=`sed -n '/^!\/[[:alpha:]]/'p *.ftn | awk '{print $1}' | \ sed 's/^!\///' | sed 's/[\/!].*$//' | sort -u` set $all # --------------------------------------------------------------------------- # # 3. Display in organized manner # # --------------------------------------------------------------------------- # last= line=' ' while [ "$#" -gt '0' ] do next=$1 ; shift if [ -z "$last" ] ; then line="$line $next" else if [ "`echo $last | cut -c1-1`" != "`echo $next | cut -c1-1`" ] ; then echo "$line" line=' ' fi line="$line $next" fi last=$next done echo "$line" echo ' ' echo 'end of all_switches' # End of all_switches ------------------------------------------------------- #