Hi, I'm trying to use a code that change the wallpaper automatically, but I obtain the next error:
Line 18: Unexpected EOF while looking for matching `` '
Line 25: sintax error: Unexpected End of File

I think the code line is:
cnt=`wc -l "$temp_bg_list" | cut -f1 -d " "`

But I really don't understand what is the problem, so, can you help me?

Thanks a lot

#tomado de: www.djlosch.com

extensions="jpg png gif jpeg JPG GIF PNG"

rm -f $temp_bg_list

for extension in $extensions
    find $bg_path -iregex ".*.$extension" >> "$temp_bg_list"

cnt=`wc -l "$temp_bg_list" | cut -f1 -d " "`
all_bgs=`echo \ `expr $RANDOM % $cnt\``

selected_bg=`head -n$all_bgs "$temp_bg_list" | tail -n1`

logger "Changed desktop to: $selected_bg"

gconftool-2 -t string -s /desktop/gnome/background/picture_filename 
exit 0

Hey There,

I think might actually be this line:

all_bgs=`echo \ `expr $RANDOM % $cnt\``

since the first backtick inside your backtick has a space between the escape and backtick.
It think it should be this

all_bgs=`echo \`expr $RANDOM % $cnt\``

Sometimes I find it easier to mix different ways of doing the same thing when I have multiple recursive exec, like the line above could be change to:

all_bgs=$(echo `expr $RANDOM % $cnt`)

and still do the same thing.

Hope that helps :)

, Mike

This article has been dead for over six months. Start a new discussion instead.