blind to an unterminated s command


Results 1 to 7 of 7

Thread: blind to an unterminated s command

  1. #1
    Join Date
    Jan 2003
    Posts
    1,012

    blind to an unterminated s command

    In a continuations of sorts from this thread which I consider to be solved; http://justlinux.com/forum/showthread.php?t=154079, like any script it must be tinkered with.

    So I added a couple of more variables to be changed. Here is the most relevant part;
    Code:
      FILE_LIST=`ls -1 *.bz2`
      SHA1SUM=`sha1sum -b $FILE_LIST | cut -d* -f1| cut -d" " -f1`
      MODULE_NAME=`ls -1 *.bz2 | sed -e "s:-${OLD_VER}.tar.bz2::"`
      DATE=`date -u +%Y%m%d`
    
        for i in $MODULE_NAME
      do
      MODULE_LOCATION=`lvu where $i`
      MODULE_PATH="/home/dveatch/moonbase.git/$MODULE_LOCATION"
      sed -i "s:${OLD_VER}:${NEW_VER}:" $MODULE_PATH/$i/DETAILS
      sed -i "s/UPDATED=[^=]*$/UPDATED=${DATE}/" $MODULE_PATH/$i/DETAILS
      sed -i "s|SOURCE_VFY=sha1:[^:]*$|SOURCE_VFY=sha1:${SHA1SUM}|" $MODULE_PATH/$i/DETAILS
      cd $L10N
      MODULE_LOCATION=`lvu where $i`
      MODULE_PATH="/home/dveatch/moonbase.git/$MODULE_LOCATION"
      sed -i "s:${OLD_VER}:${NEW_VER}:" $MODULE_PATH/$i/DETAILS
      sed -i "s/UPDATED=[^=]*$/UPDATED=${DATE}/" $MODULE_PATH/$i/DETAILS
      sed -i "s/SOURCE_VFY=sha1:[^:]*$/SOURCE_VFY=sha1:${SHA1SUM}/" $MODULE_PATH/$i/DETAILS
      done
    The problem is with the SOURCE_VFY sed line. It works in that the correct sha1 sums get stuffed in the correct DETAILS file and all that. But after each sed of the SOURCE_VFY it throws this non-fatal error;

    Code:
    sed: -e expression #1, char 81: unterminated `s' command
    For the life of me I cannot see the problem. It does the exact same thing as the UPDATED sed line (no errors shown) in that I'm using the same method to sed out after a certain character.

    At first I thought it might be the SHA1SUM variable. It initially looked like this;
    Code:
    SHA1SUM=`sha1sum -b $FILE_LIST | cut -d* -f1`
    When generating a sha1 it outputs like this;
    Code:
    78b25e93a8c70ccc1e0f117cce960fe4e1deb8d8 */var/spool/lunar/kdelibs-4.7.4.tar.bz2
    Note there is a space between the last sha1 character and the asterisk. So I thought that space might be causing it but changing it to;

    Code:
    SHA1SUM=`sha1sum -b $FILE_LIST | cut -d* -f1| cut -d" " -f1`
    had no effect. It seems odd if there really was an unterminated s command that it did not blow up.
    You can tuna piano, but you can't tune a fish.

    http://www.lunar-linux.org/
    It's worth the spin.

    http://www.pclinuxos.com/page.php?7
    Puts the rest to shame.

  2. #2
    Join Date
    Sep 1999
    Location
    Cambridge, UK
    Posts
    509
    You have the same problem as before. SHA1SUM is a newline-separated list of digests but you are treating it as a single digest.

  3. #3
    Join Date
    Jan 2003
    Posts
    1,012
    Quote Originally Posted by furrycat View Post
    You have the same problem as before. SHA1SUM is a newline-separated list of digests but you are treating it as a single digest.
    The problem was a "/" being appended at the end of generating the sha1's. This is what I used to get around that;

    Code:
     shasum=$(echo ${SHA1SUM} | sed 's:/::g')
      sed -i "s/SOURCE_VFY=sha1:[^:]*$/SOURCE_VFY=sha1:${SHASUM}/" $MODULE_PATH/$i/DETAILS
    You can tuna piano, but you can't tune a fish.

    http://www.lunar-linux.org/
    It's worth the spin.

    http://www.pclinuxos.com/page.php?7
    Puts the rest to shame.

  4. #4
    Join Date
    Jan 2003
    Posts
    1,012
    There are times I can be so thick headed that I doubt a short stay in a Total Perspective Vortex is capable of penetrating such density.

    Thought my last post had the problem solved. Which is what I get for not paying close attention and found it was wrong when the script was actually needed.

    After using a witching rod, Ouija Board, other sundry incantations and taking longer than it should. I have found the real solution, well one that actually works;
    Code:
      FILE_LIST="`ls -1 *.bz2`"
      MODULE_NAME=`ls -1 *.bz2 | sed -e "s:-${NEW_VER}.tar.bz2::"`
      DATE=`date -u +%Y%m%d`
    
      for i in $MODULE_NAME
      do
      MODULE_LOCATION=`lvu where $i`
      MODULE_PATH="/home/dveatch/moonbase.git/$MODULE_LOCATION"
      SHA1SUM=`sha1sum -b $i*.tar.bz2 | cut -d* -f1| cut -d" " -f1`
      set -x
      sed -i "s:${OLD_VER}:${NEW_VER}:" $MODULE_PATH/$i/DETAILS
      sed -i "s/UPDATED=[^=]*$/UPDATED=${DATE}/" $MODULE_PATH/$i/DETAILS
      sed -i "s|SOURCE_VFY=sha1:[^:]*$|SOURCE_VFY=sha1:${SHA1SUM}|" $MODULE_PATH/$i/DETAILS
      set +x
      done
    Now I just need to add some error checking to flag any modules that might not exist.
    You can tuna piano, but you can't tune a fish.

    http://www.lunar-linux.org/
    It's worth the spin.

    http://www.pclinuxos.com/page.php?7
    Puts the rest to shame.

  5. #5
    Join Date
    Jul 2002
    Location
    New Orleans, LA USA
    Posts
    986
    Quote Originally Posted by stumbles View Post
    there are times i can be so thick headed that i doubt a short stay in a total perspective vortex is capable of penetrating such density.
    "Whenever you find yourself on the side of the majority, it's time to pause and reflect."

    -Mark Twain

  6. #6
    Join Date
    Sep 1999
    Location
    Cambridge, UK
    Posts
    509
    Do you see now why I said you had the same problem as before?

  7. #7
    Join Date
    Jan 2003
    Posts
    1,012
    Quote Originally Posted by furrycat View Post
    Do you see now why I said you had the same problem as before?
    Oh for sure.... now.

    How I could miss such a simple thing as to actually use the "$i" in a "for i" loop is a testament that the Devil is in the details. To bad there is no equivalent of Lasik Mind Surgery.
    You can tuna piano, but you can't tune a fish.

    http://www.lunar-linux.org/
    It's worth the spin.

    http://www.pclinuxos.com/page.php?7
    Puts the rest to shame.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •