source: trunk/essentials/app-shells/bash/examples/scripts/shprompt@ 3506

Last change on this file since 3506 was 3228, checked in by bird, 19 years ago

bash 3.1

File size: 2.2 KB
Line 
1#
2# shprompt -- give a prompt and get an answer satisfying certain criteria
3#
4# shprompt [-dDfFsy] prompt
5# s = prompt for string
6# f = prompt for filename
7# F = prompt for full pathname to a file or directory
8# d = prompt for a directory name
9# D = prompt for a full pathname to a directory
10# y = prompt for y or n answer
11#
12# Chet Ramey
13# [email protected]
14
15type=file
16
17OPTS=dDfFsy
18
19succeed()
20{
21 echo "$1"
22 exit 0
23}
24
25while getopts "$OPTS" c
26do
27 case "$c" in
28 s) type=string
29 ;;
30 f) type=file
31 ;;
32 F) type=path
33 ;;
34 d) type=dir