You are not logged in.

#1 2009-04-22 17:58:33

zandaa
Member
From: The Netherlands
Registered: 2008-07-14
Posts: 33
Website

bash + file help for pipe-menus

I'm trying to write a few bash scripts to read *.desktop files and convert them to a filetype I can use in a pipe-menu for openbox.. I want to take the Name and Exec from each desktop file and stuff them in a seperate file for each application so I can use these in my openbox pipe-menu..

I've got this so far:

#!/bin/sh

    for file in *.desktop
    do
        appname=$(cat $file | grep Name= | cut -d "=" -f2)
        appexec=$(cat $file | grep Exec= | cut -d "=" -f2)
        newfile=$(echo $(echo $file | cut -d "." -f1).item)
        echo Name=$appname > $newfile
        echo Exec=$appexec >> $newfile
        rm $file
    done
fi

however, I'm wondering if there is a more elegant solution to building pipe-menus besides making directories called Accessories, Games, etc. and stuffing them with my *.item files which follow the following format:

Name=Gimp
Exec=gimp-2.6

With my army of penguins, I shall overthrow governments and free those who have been waiting for liberty.

Offline

Board footer

Powered by FluxBB