next | next | up | end | Inhalt | Uebungen | Complete | Kommentar

all, section 10.22.

10.22.  Argumente III:

 1      #!/bin/sh
 2      #       arguments
 3      #
 4      
 5      gawk '
 6      BEGIN   {       print "ARGC = ", ARGC
 7                      for ( i = 0; i < ARGC; i ++ )   {
 8                              if ( ARGV[i] ~ /^-/ )   {
 9                                      print "Flag: ", ARGV[i]
10                                      if ( ARGV[i] ~ /^-x$/ )         {
11                                              print "-x"
12                                              ARGV[i] = ""
13                                      } else if ( ARGV[i] ~ /^-f$/ )  {
14                                              print "-f"
15                                              print "file: ", ARGV[i+1]
16                                              ARGV[i] = ""
17                                              ARGV[i+1] = ""
18                                      }
19                              } else
20                                      if ( ARGV[i] != "" )
21                                              print "Inputfile: ", ARGV[i]
22      
23                      }
24              
25              }
26              {       print "---", $0, "-----"                }
27      
28      '  "$@"


back | next | up | end | Inhalt | Uebungen | Complete | Kommentar


Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 03/July/97