File tree 1 file changed +34
-7
lines changed
1 file changed +34
-7
lines changed Original file line number Diff line number Diff line change @@ -21,18 +21,26 @@ echo ""
21
21
unset options i
22
22
while IFS= read -r -d $' \0' f; do
23
23
options[i++]=" $f "
24
- done < <( find ./ -maxdepth 1 -type f -name " *.txt" -print0 )
25
- if [ -z " ${options[0]} " ]
26
- then
27
- echo -e " ${RED} No valid .txt list found in current directory,${NC} exiting."
28
- exit
29
- fi
30
- select opt in " ${options[@]} " " Quit" ; do
24
+ done < <( find ./ -maxdepth 1 -type f -name " *.txt" -print0 )
25
+ # if [ -z "${options[0]}" ]
26
+ # then
27
+ # echo -e "${RED}No valid .txt list found in current directory,${NC} exiting."
28
+ # exit
29
+ # fi
30
+ select opt in " ${options[@]} " " Paste " " Quit" ; do
31
31
case $opt in
32
32
* .txt)
33
33
echo " $opt selected"
34
34
break
35
35
;;
36
+ " Paste" )
37
+ printf " \n"
38
+ read -d " @" -p " Paste links here (then press \" @\" when done) :
39
+ " paste
40
+ echo " $paste " > ./Paste
41
+ printf " \n"
42
+ break
43
+ ;;
36
44
" Quit" )
37
45
# echo "You chose to stop"
38
46
exit
@@ -43,6 +51,25 @@ select opt in "${options[@]}" "Quit"; do
43
51
esac
44
52
done
45
53
54
+ # CHECK IF FILE IS EMPTY
55
+ if [ -f $opt ]
56
+ then
57
+ if ! [ -s $opt ]
58
+ then
59
+ echo " File exists but empty."
60
+ exit
61
+ fi
62
+ count=$( wc -c < $opt )
63
+ if [ $count -lt 4 ]
64
+ then
65
+ echo " File is empty."
66
+ exit
67
+ fi
68
+ else
69
+ echo " File not exists."
70
+ exit
71
+ fi
72
+
46
73
# ASKS DOWNLOAD DESTINATION
47
74
read -e -p " Download Folder (enter or q to quit) : " targetdir
48
75
You can’t perform that action at this time.
0 commit comments