Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Menu/AWK/menu.awk
Normal file
24
Task/Menu/AWK/menu.awk
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# syntax: GAWK -f MENU.AWK
|
||||
BEGIN {
|
||||
print("you picked:",menu(""))
|
||||
print("you picked:",menu("fee fie:huff and puff:mirror mirror:tick tock"))
|
||||
exit(0)
|
||||
}
|
||||
function menu(str, ans,arr,i,n) {
|
||||
if (str == "") {
|
||||
return
|
||||
}
|
||||
n = split(str,arr,":")
|
||||
while (1) {
|
||||
print("")
|
||||
for (i=1; i<=n; i++) {
|
||||
printf("%d - %s\n",i,arr[i])
|
||||
}
|
||||
printf("? ")
|
||||
getline ans
|
||||
if (ans in arr) {
|
||||
return(arr[ans])
|
||||
}
|
||||
print("invalid choice")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue