1#!/bin/sh 2# updateconfig.sh 3# Script to update pre-0.3 GKrellMLaunch config items to 0.3 format. 4 5# Directory in which the user_config file lives. This will need to be 6# modified if you're using a system-wide config. 7#cd $HOME/.gkrellm 8 9# Back up the original config file, just in case... 10echo -n Backing up config file... 11#cp user_config user_config.bak 12echo Done. 13echo -n Updating GKrellMLaunch config items... 14 15# Old format is visible1 1, cmd1 rxvt, label1 rxvt on separate lines. 16# New format is visible=1, label=rxvt, cmd=rxvt on one line 17 18# Need to splce together the individual config elements for each button 19# into one line. So, loop the items & save them off 20 21# Dump the non-gkrellmlaunch items first 22#grep -v gkrellmlaunch user_config > user_config.bak 23 24gkrellmlaunch=`grep gkrellmlaunch user_config` 25 grep gkrellmlaunch user_config | sed -e 's/gkrellmlaunch visible[0-9]* \(.*\)/\1/g' | sed -e 's/gkrellmlaunch cmd[0-9]* \(.*\)/\1/g' | sed -e 's/gkrellml aunch label[0-9]* \(.*\)/\1/g' 26 27#echo $gkrellmlaunch 28j=1 29for i in `grep gkrellmlaunch user_config` 30do 31 echo "i is: $i" 32 if [ $j -eq 1 ];then 33 echo `cat ${i} | cut -b24-` 34 fi 35 if [ $j -eq 2 ];then 36 echo `cat ${i} | cut -b20-` 37 fi 38 if [ $j -eq 3 ];then 39 echo `cat ${i} | cut -b22-` 40 41 fi 42 j=`expr $j + 1` 43done 44#do 45# echo $i 46#done 47#for item in $gkrellmlaunch 48# do 49 # If it's not gkrellmlaunch, then it's a command/label that's been 50 # split up by the above grep. Keep looping & appending until we 51 # hit another gkrellmlaunch 52# echo "Got $item" 53# if [ $item != "gkrellmlaunch" ]; then 54# for appendItem in $gkrellmlaunch 55# do 56# echo "Append $appendItem" 57# done 58# fi 59# done 60 61 62echo Done. 63echo Please inspect the user_config file to confirm that everything\'s as it \ 64should be. When happy, you may delete the user_config.bak file. 65 66