-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdnc
More file actions
25 lines (24 loc) · 692 Bytes
/
dnc
File metadata and controls
25 lines (24 loc) · 692 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
#!/bin/bash
#dnc stands for download and copy
DIRECTORY=/home/tom/picture_download
if [ !-d $DIRECTORY ]; then
mkdir -p $DIRECTORY
fi
j=$(dmenu)
for i in j do
for c in "png jpg"; do
a= $(echo $i | sed "s/https:.*$c//g") # matches jpg and .png files
if [ $a=="" ]; then
tmp=$(echo $i | sed "s@^[a-zA-Z0-9]*$c@@g" ) # replace the whole uml by the actual name wth the ending .jpg or .png
wget $i
xclip -selection -t image/$c -i "$DIRECTORY/$tmp"
fi
done
for c in "txt c java py html js h hs"; do
a=$(echo $i | sed "s/https:.*$c//g")
if [ $a=="" ]; then
tmp=$(echo $i | sed "s@^[a-zA-Z0-9]*$c@@g" )
wget $i
xclip -selection -i "$DIRECTORY/$tmp"
done
done