Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

I'm a fucking idiot.

Name: Anonymous 2009-05-11 8:22

Sup /prog/. bash noob here, and I need some help getting a short script of mine working.

#!/bin/bash

cd ~/wallpapers

while [ 1 ]
do
n=$(ls |sort -R |tail -1)
gconftool-2 --type string --set /desktop/gnome/background/picture_filename $n
sleep 5 m
done

I've done debugging with echo, so I know that the file names are correct. One thing that I also checked, that didn't help, was changing the "$n" line to the absolute path, "~/wallpapers/$n", with no luck. I also played around with quotation marks, and still, no luck. No matter what I do, it changes the background to a flat brown.

When I run the command

gconftool-2 --type string --set /desktop/gnome/background/picture_filename "~/wallpapers/example.jpg"

it works correctly.


I'm running Ubuntu Intrepid, not sure if that helps at all.

Thanks in advance.

Name: Anonymous 2009-05-11 9:28

1) Don't ever use "ls" in bash scripting, "find" instead
2) You could use $HOME/wallpapers as variable
3) "sort -R | tail -1" picks something at random? Use "shuf -n1"
4) Id use a cronjob instead of while; do; sleep; done

Maybe none of this works, I don't use gnome (neither should you) and cant use test bash atm

Name: Anonymous 2009-05-11 9:32

cd ~/wallpapers
Fucking fail, put it into $DIR or something, and then invoke gconftool with "$DIR/$n"

sleep 5 m
man sleep you fucking moron

$n
Should be "$n" if your filenames are disgusting enough to have spaces in them

Name: Anonymous 2009-05-11 9:33

>>2
1) Don't ever use "ls" in bash scripting, "find" instead
I suggest *.

Name: Anonymous 2009-05-11 10:12

>>1
Personally I suggest that you get your anus haxed.

Name: Anonymous 2009-05-11 10:51

>>2
Thanks, shuf -n1 was just what I needed.

>>3
I guess I should have specified that I am retarded, hence the shit like cd ~/wallpapers, etc.

>>4
So you're saying use find $HOME/wallpapers/* | shuf -n1, right?

>>5

Don't know how to do that.

I suppose starting with the title of "I am an idiot" gave myself too much credit, huh?

Anyways, thanks guys, you were great.

Name: Anonymous 2009-05-11 11:00

(Post truncated.)
Stopped reading right there

Name: Anonymous 2009-05-11 11:03

>>7

>>6

>Anyways, thanks guys, you were great.

lol

Name: Anonymous 2011-01-31 20:29

<-- check em dubz

Don't change these.
Name: Email:
Entire Thread Thread List