0

Within my Jenkins Job , i'm using an environment variable : $SVN_URL where:

$SVN_URL=http://svn.local:8080/svn/project1/trunk

i'm executing in a further step this shell command :

svn copy http://svn.local:8080/svn/project1/trunk http://svn.local:8080/svn/project1/tags/v$RELEASE_VERSION \
           -m "Tagging the v$RELEASE_VERSION release"

this command can be replaced by this (using my $SVN_URL):

svn copy $SVN_URL http://svn.local:8080/svn/project1/tags/v$RELEASE_VERSION \
           -m "Tagging the v$RELEASE_VERSION release"

But i still not able to optimise it for the second part which is :

http://svn.local:8080/svn/project1/tags/v$RELEASE_VERSION

So i wann use my $SVN_URL for it.

So to resume :

  1. My $SVN_URL contains : http://svn.local:8080/svn/project1/trunk/
  2. i wanna retrieve from it the part : /trunk/
  3. add it the part : /tag/

Suggestions ?

firasKoubaa
  • 6,439
  • 25
  • 79
  • 148
  • you can use `sed` – Marcin Orlowski Mar 01 '17 at 08:40
  • 1
    Possible duplicate of [Extract substring in Bash](http://stackoverflow.com/questions/428109/extract-substring-in-bash) – tripleee Mar 01 '17 at 08:48
  • Many of the answers to that question are portable to other POSIX shells. There is no shell at all tagged here so it's not unlikely that the question is *actually* a Bash question. EIther way, a common duplicate, and too broad because the OP doesn't seem to have done any sort of research before posting. – tripleee Mar 01 '17 at 08:52

1 Answers1

0

i used simply "sed" and that worked fine

svn copy $SVN_URL "$(echo $SVN_URL| sed 's/trunk/tags/')"/v$RELEASE_VERSION \
          -m "Tagging the v$RELEASE_VERSION release"
firasKoubaa
  • 6,439
  • 25
  • 79
  • 148