-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck
More file actions
38 lines (30 loc) · 908 Bytes
/
check
File metadata and controls
38 lines (30 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# oxr 2025
# Chequeo de opciones
# Las acciones son [s]si [enter|n]no [q]quitar/cancelar
# La salida, se recoge con '$?' ,si>0 no>1 cancelar>2 quitar>3
#
# \\r check [-] texto && ... || ...
#
# '-' No termina al pulsar [q] cuando fue incluido en un script o bash con
# \\r '. check', en bash se cerraria el terminal !!
[ $include_ctl ] || . include ; include parp
check_E(){
local sp="/-/" # separador para parp
[ $# -eq 2 ] && check_T="$check_T $sp :" || check_T="^ $check_T $sp , -"
parp -s $sp $check_T -z -c 74 [$1] $sp +- 2
}
check(){
[ $# -ne 0 ] || { infsh ~/code/check 3 10 ; return 2 ;}
local check_T="$@" check_R="" check_Q=true
[ "$1" != "-" ] || { shift ; check_Q=false; }
check_E s -
read check_R
case $check_R in
s) check_E s ; return 0 ;;
q) check_E q ; $check_Q && exit 3 || return 2 ;;
*) check_E n ; return 1 ;;
esac
}
[ ${0##*/} != check ] || check "$@"
#