-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInput 7
More file actions
79 lines (70 loc) · 1.57 KB
/
Input 7
File metadata and controls
79 lines (70 loc) · 1.57 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
What I've done:
Part of the assignment asks to have a GUI interface and to allow the user to input directories. I've spent the last workshop, creating a GUI with output, I will later implement the java I have been working on.
script:
#!/bin/bash
DIALOG_CANCEL=1
DIALOG_ESC=255
HEIGHT=0
WIDTH=0
display_result() {
dialog --title "$1" \
--no-collapse \
--msgbox "$result" 0 0
}
while true; do
exec 3>&1
selection=$(dialog \
--backtitle "System Information" \
--title "Menu" \
--clear \
--cancel-label "Exit" \
--menu "Please select:" $HEIGHT $WIDTH 4 \
"1" "Directory Selection" \
"2" "Run Program" \
"3" "Current Directory" \
2>&1 1>&3)
exit_status=$?
exec 3>&-
case $exit_status in
$DIALOG_CANCEL)
clear
echo "Program terminated."
exit
;;
$DIALOG_ESC)
clear
echo "Program aborted." >&2
exit 1
;;
esac
case $selection in
0 )
clear
echo "Program terminated."
;;
1 )
DIALOG=${DIALOG=dialog}
FILE=`$DIALOG --stdout --title "Please choose a file" --fselect $HOME/ 14 48`
case $? in
0)
echo "\"$FILE\" chosen";;
1)
echo "Cancel pressed.";;
255)
echo "Box closed.";;
esac
;;
2 )
du -h -m --max-depth=1 $FILE > mapped.txt
sleep 5
result=$(cat mapped.txt)
display_result "mapped"
;;
3 )
tcdialog --title 'test 3' --msgbox mapped.txt 100 50
;;
esac
done
Output:
What needs to be done next:
I need to implement my java program into this