File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ HN="hostname -I"
25
25
res=$( eval $HN )
26
26
arrIN=(${res// / } )
27
27
IP=" "
28
+ # TODO:Make GetPort function that takes either user input or cmdline argument for custom port
29
+ PORT=8099
28
30
29
31
# if there is more than one IP available, list the first two as options
30
32
# TODO: make a way to list all options
@@ -34,19 +36,24 @@ if [ ${#arrIN[@]} -gt 1 ]; then
34
36
select opt in " ${options[@]} "
35
37
do
36
38
case $opt in
39
+ # Selecting "1" will assign the first IP to $IP
37
40
" ${arrIN[0]} " )
38
41
IP=" ${arrIN[0]} "
39
42
break
40
43
;;
41
-
44
+ # Selecting "2" will assign the second IP to $IP
42
45
" ${arrIN[1]} " )
43
46
IP=" ${arrIN[1]} "
44
47
break
45
48
;;
49
+ # Selecting "3" will exit the program
46
50
" Quit" )
47
- break
51
+ exit 0
52
+ ;;
53
+
54
+ # Any input other than 1-3 will result in this error message
55
+ * ) echo " Invalid option: $REPLY "
48
56
;;
49
- * ) echo " Invalid option: $REPLY " ;;
50
57
esac
51
58
done
52
59
else
56
63
echo " "
57
64
echo " IP: " $IP
58
65
echo " "
59
- echo -e " File links... \n"
66
+ echo -e " Download files using these links: \n"
60
67
for entry in ` ls` ; do
61
68
if [ ! -d $entry ]; then
62
69
wgetCmd=$( echo " wget http://${IP##* ( )} :8099/$entry " | xargs)
63
70
echo -e " \t$GN$wgetCmd$RES "
64
71
fi
65
72
done
66
73
echo " "
67
- echo -e " \nCurrent Directory Contents"
74
+ echo -e " \nCurrent Directory Contents: "
68
75
ls --color .
69
76
echo " "
70
- echo -e " \nStarting Server"
77
+ echo -e " \nStarting Server... "
71
78
72
- python3 -m http.server 8099 -d .
79
+ # Opens HTTP Server in the folder the command is run from on port $PORT
80
+ python3 -m http.server $PORT -d .
You can’t perform that action at this time.
0 commit comments