How do you export svn revision number to a variable within a script?
Can't grep or awk revision info when running an svn checkout script. Tried this:
Code:
svn checkout name.of.place/trunk Help would be great! Regards |
Quote:
Code:
VERSION=$(svn info name.of.place/trunk 2>&1|awk '/^Revision:/ {print $2}') |
Thanks!
Ended up using: Code:
VERSION=$(svn info http://place.net/trunk/ 2>&1|awk '/^Revision:/ {print $2}') If I use: Code:
VERSION=$(svn checkout http://place.net/trunk | grep -o '[0-9]*') Would be nice to do this in one instance of svn rather than executing svn twice (svn checkout ; svn --info). |
What you should understand firstly is that the 'checkout' command is the wrong tool for the job. Compared to 'info' it's an inefficient transaction because it provides more information than needed (it actually places code in the system while it's at all not necessary) and if you have a large code base it might take more time than strictly necessary. Secondly, and I don't know if this is a botched example or not, but your 'cp' command shows no destination. I don't know how a 'cp' should complete that way?.. Finally I pointed you to debugging your shell script by setting "set -vx". Using it (also in code you post?) helps you see and understand what goes on "under the hood". It comes in handy especially if you're not certain about the commands you use. Do try using it.
|
The cp command is run in the same working directory. Tried using set -vx but it shows nothing when running from script (didn't try outside the script). Thanks for your help.
Regards |
It also helps to post an example of the text that you're working with, BTW. Both input and desired output. I was wondering if something cleaner couldn't be written, but I don't have any way to produce the type of svn output you're working on, so I'm unable to test any possible solutions for you.
|
All times are GMT -5. The time now is 05:47 AM. |