I have a script which performs a getline (customer enters data) and a list is returned which has the data that was entered return to them. Then it ends. How can I get this script to return to the begin and ask the question again.
Ths script needs to stop after the list is returned and then hit enter to continue or quit to end.
The getline is in the BEGIN section.
Thank You
1 # Parse input from the command line to look up a persons
2 # employee record.
3 BEGIN {
4 system("clear")
5 blank = " "
6 if (ARGC > 2)
7 {
8 printf("argc = %d >%s >%s >%s",ARGC,ARGV[0],ARGV[1],ARGV[2])
9 nvar = ARGV[2]
10 delete ARGV[2]
11 }
12 else
13 {
14 printf("Please enter your name or emp# : > ")
15 getline nvar < "/dev/tty"
16 # getline var < "-"
17 printf(">>>>> %s",nvar)
18 }
19 printf("\nName\t\t\t\tEmployee No.\tWeekly Pay\n\n")
20 }
21 # This section retrieves the total name from the DB
22 # $0 ~ /\<nvar\>/ {
23 $0 ~ nvar {
24 numnames = NF-4
25 name = $1
26 for (var=2; var<=numnames; var++)
27 {
28 name = name blank $(var)
29 }
30 # This section calculates weekly pay
31 wpay = $(NF) * $(NF-1)
32 # This prints the output line
33 printf("%-30s\t%s\t$ %.2f\n",name,$(NF-3),wpay)
34 }
35 END {
36 printf(" \n")
37 }