#!/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