blob: 8b709edb3ad64ae0551edbabd043cfe33733ac8f (
plain)
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
|
#!/usr/bin/bash
wallDir=/media/Wall
for action in $@
do
if [ ${action:0:1} = "+" ]
then
if [ -d ${wallDir}/${action:1} ]
then
echo ${action:1}/ >> ${wallDir}/listDirWall
fi
fi
if [ ${action} = "list" ]
then
for d in `ls ${wallDir}`
do
if [ -d "${wallDir}/${d}" ]; then
echo "$d/"
fi
done
echo
fi
if [ ${action:0:1} = "-" ]
then
if [ -d ${wallDir}/${action:1} ]
then
sed -i "/${action:1}/d" ${wallDir}/listDirWall
fi
fi
if [ ${action:0:1} = "=" ]
then
if [ -d ${wallDir}/${action:1} ]
then
sed -i "/^${action:1}\/$/d" ${wallDir}/listDirWall
fi
fi
done
cmpWall=0
for ligne in `cat ${wallDir}/listDirWall`
do
cmpWall=$(( cmpWall + `ls "${wallDir}/$ligne" | wc -l` ))
echo "$ligne : "
done
randWall=$[( $RANDOM % $cmpWall )]
for ligne in `cat ${wallDir}/listDirWall`
do
if [ `ls "${wallDir}/$ligne" | wc -l` -gt $randWall ]
then
echo ${wallDir}/$ligne`ls ${wallDir}/$ligne | head -n $randWall | tail -n 1` > ~/.actWall
nitrogen --set-zoom-fill ${wallDir}/$ligne`ls ${wallDir}/$ligne | head -n $randWall | tail -n 1`
echo "Wall set " ${wallDir}/$ligne`ls ${wallDir}/$ligne | head -n $randWall | tail -n 1`
break
else
randWall=$(( randWall - `ls "${wallDir}/$ligne" | wc -l` ))
fi
done
echo $cmpWall
|