Writing a script to do the following;
- download some tarballs
- use the tarball names to create a name list
- use name list as part of a path
- use sed to update specific variables in another script
Here is what I have so far;
Code:
#!/bin/bash --verbose
set -x
NEW_KDE=/home/dveatch/kde-update
OLD_VER="4.7.4"
NEW_VER="4.8.0"
SOURCE_URL=ftp://ftp.kde.org/pub/kde/stable/${OLD_VER}/src
FILE_LIST=`ls -1 *.bz2`
MODULE_NAME=`ls *.bz2 | sed -e "s:-${OLD_VER}.tar.bz2::"`
MODULE_LOCATION=`lvu where $MODULE_NAME`
MODULE_PATH="/home/dveatch/moonbase.git/$MODULE_LOCATION/$MODULE_NAME"
if [ ! -d $NEW_KDE ] ; then
mkdir -p $NEW_KDE
cd $NEW_KDE
wget -c $SOURCE_URL/$FILE_LIST
else
cd $NEW_KDE
wget -nc -cq $SOURCE_URL/$FILE_LIST
fi
for i in $MODULE_PATH
do
sed -i "s:${OLD_VER}:${NEW_VER}:" "$i"/DETAILS
done
set +x
The problem is this; it will properly sed the first entry in $MODULE_PATH. In this case it is blinken and the output looks like this;
Code:
+ for i in '$MODULE_PATH'
+ sed -i s:4.7.4:4.8.0: /home/dveatch/moonbase.git/kde4/games/blinken/DETAILS
However it doesn't do that for the rest of the items in $MODULE_PATH throwing errors like this;
Code:
+ for i in '$MODULE_PATH'
+ sed -i s:4.7.4:4.8.0: cantor/DETAILS
sed: can't read cantor/DETAILS: No such file or directory
Obviously $MODULE_PATH is not being read correctly but for the life of me the brain is not pivoting around to cypher how to make it get to use the path right for the remaining items.
In case your wondering, I have a system command called "lvu" and when used like this;
lvu where $MODULE, it will output this (using smokeqt as an example;
Code:
lvu where blinken
kde4/development