1

I've looked around for an answer but it seems like none of them deal with multiple variables like in my case so I'm hoping someone here can help me with a little bash-fu.

I have an svn log like so:

rXXXX  |  username   |  2017-11-23  11:28:13  -0400  (date blah blah) | 1 line

here's the comment.

I'm looking to grab the revision number AND the comment but here's the catch I'm going through multiple repos and (another identifier call it id) so I have a loop like so:

for REPO in REPOS
do
    for ID in IDS
    do
        svn log --search $ID $REPO
        #need to grab revision and comment in here
        REVISION=''
        COMMENT=''
    done
done

So I need to get these in variables and then do my thing with them.

I would appreciate any help.

EDIT: oh before people mention it I'm unable to use anything beside svn and bash commands based on my setup.

3
  • When you say only "bash commands", do you mean only shell builtins? So you can use other languages like awk? Commented Nov 23, 2017 at 16:40
  • yeah awk is fine but I'm working with a basic linux install, so I can't go get any tools or anything that doesn't come standard Commented Nov 23, 2017 at 16:58
  • That's a heck of a lot more than just bash commands then. The "basic linux install" depends on the distro and quite often includes (for example) perl and python. Commented Nov 23, 2017 at 17:04

1 Answer 1

1

You could do something like this:

while read REVISION _; do
    read _
    read COMMENT
    break
done < <(svn log --search "$ID" "$REPO")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.