-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb
executable file
·44 lines (36 loc) · 970 Bytes
/
b
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
39
40
41
42
43
44
#!/bin/bash
prompt="Select usb to serial port:"
options=( $(find /dev/*cu.usbserial* | xargs -0) )
if (( ${#options[@]} == 1 )) ; then
opt1=$options
echo "Using $options"
else
PS3="$prompt "
echo ""
select opt1 in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
echo "Selected usb to serial: $opt1"
break
else
echo "Invalid option. Try another one."
fi
done
fi
prompt="Select hex file:"
options=( $(find *.hex | xargs -0) )
PS3="$prompt "
echo ""
select opt2 in "${options[@]}" "Quit" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
exit
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
echo "Selected hex file: $opt2"
./pdex -p$opt1 $opt2
break
else
echo "Invalid option. Try another one."
fi
done
echo ""