#!/bin/bash set -x #Get the pics DIR=~/wallpaper/to_post MESSAGE=$DIR/newspost.txt NUM_PIC=24 #number of pictures to be posted # COUNTING : Counting and sorting files COUNTING () { find $DIR/nude -name "*.jpg" >> $DIR/files.txt TOTAL=`wc -w < $DIR/files.txt` for COUNT in `seq 18` #35 do if [ $TOTAL = "0" ] then rm $DIR/files.txt exit fi FILE=`head -n 1 $DIR/files.txt|awk -F: '{print $NF}'` echo $FILE >> end_file.txt grep -v $FILE $DIR/files.txt > $DIR/files.txt.tmp mv $DIR/files.txt.tmp $DIR/files.txt let TOTAL=TOTAL-1 done rm $DIR/files.txt cat > $MESSAGE < /dev/null 2>&1` && MESSAGE } MESSAGE () { cat >> $MESSAGE <