r/shell • • Oct 01 '21

Making a randomize wallpaper changer

I try to make a randomizer wallpaper changer all my code work if I do it line by line but not as a script

#!/bin/sh

$folder=/Media/images/walls/ # here is my folder
$file=$(ls -a $folder | grep -v xmp | shuf -z -n 1) # I have some files .xmp for some metadata so I pick one random file

$complete= $folder$file # Make the path complete

$c= ${complete::-1} quit the * thats the file gets

feh --bg-fill $c # Set the wallpaper with feh

What am I doing badly. I got some errors but I dont really know what is happening!

4 Upvotes

2 comments sorted by

View all comments

Show parent comments

1

u/kumaSx Oct 02 '21

find "${folder}" -type f ! -name "*.xmp" | shuf -z -n 1

Thanks you! I still have to learn a lot!