Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Shell Script Game

Options
  • 03-04-2009 8:44pm
    #1
    Registered Users Posts: 1,129 ✭✭✭


    This thread is inspired by the traditional q&a threads.

    The difference here is you post a shell script to achieve the task set by the before poster and then set a new task for the following poster.

    I'd say keep it simple at first and then ramp up into slightly more complex stuff.
    This will mean the thread could become a useful learning mechanism for the less
    able of us, and allow some people to try their hand at their first script.

    You can post a solution to the task not directly above you, but only if the task is completely out of your depth or you have a more elegant/creative solution to a previous task.

    Task 1: Download the daily new cyanide and happiness comic and set it as the wallpaper. (Ubuntu Gnome, feel free to do other distros/desktop managers)


Comments

  • Registered Users Posts: 1,109 ✭✭✭Skrynesaver


    Stick this in a script and call from cron.
    #!/bin/bash
    if [ ! -d  /home/skrynesaver/tmp/bgdl ] ; then
       mkdir - p /home/skrynesaver/tmp/bgdl
    fi
    cd /home/skrynesaver/tmp/bgdl
    rm index.html bgImage.png
    wget http://www.explosm.net/comics/new/
    wget -O bgImage.png $(grep -o '<img alt="Cyanide and Happiness, a daily webcomic" src="[^"]*' index.html.1 |awk -F'src="' '{print $2}' )
    conftool-2 --direct   --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory   --type string   --set /desktop/gnome/background/picture_filename bgImage.png
    


    Next up, assume you have received a collection of untagged mp3/ogg files from another OS which are in a tree
    artist-
            |->Album
            ...
             |->Album
                          |->track
                          |->track
    

    The names of the files and directories contain spaces, change all spaces to underscores in the filenames and prompt the user for the artist's genre, add this genre to the ID3Tag of each track.


Advertisement