#!/bin/sh # updateconfig.sh # Script to update pre-0.3 GKrellMLaunch config items to 0.3 format. # Directory in which the user_config file lives. This will need to be # modified if you're using a system-wide config. #cd $HOME/.gkrellm # Back up the original config file, just in case... echo -n Backing up config file... #cp user_config user_config.bak echo Done. echo -n Updating GKrellMLaunch config items... # Old format is visible1 1, cmd1 rxvt, label1 rxvt on separate lines. # New format is visible=1, label=rxvt, cmd=rxvt on one line # Need to splce together the individual config elements for each button # into one line. So, loop the items & save them off # Dump the non-gkrellmlaunch items first #grep -v gkrellmlaunch user_config > user_config.bak gkrellmlaunch=`grep gkrellmlaunch user_config` 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' #echo $gkrellmlaunch j=1 for i in `grep gkrellmlaunch user_config` do echo "i is: $i" if [ $j -eq 1 ];then echo `cat ${i} | cut -b24-` fi if [ $j -eq 2 ];then echo `cat ${i} | cut -b20-` fi if [ $j -eq 3 ];then echo `cat ${i} | cut -b22-` fi j=`expr $j + 1` done #do # echo $i #done #for item in $gkrellmlaunch # do # If it's not gkrellmlaunch, then it's a command/label that's been # split up by the above grep. Keep looping & appending until we # hit another gkrellmlaunch # echo "Got $item" # if [ $item != "gkrellmlaunch" ]; then # for appendItem in $gkrellmlaunch # do # echo "Append $appendItem" # done # fi # done echo Done. echo Please inspect the user_config file to confirm that everything\'s as it \ should be. When happy, you may delete the user_config.bak file.