In my post-receive hook, I would like to get the branch the user is committing on, store in a variable, and pass it to a web service (Hudson build system). Can I use the refname passed into STDIN for this? If so, how do I get it? I've tried
$3
, but this doesn't seem to work.
Also, adding the line
echo $3
开发者_Python百科shows just a blank.
Thanks!
Yes, you probably want the one(s) from STDIN. There may be more than one.
If you don't want to convert your script you can do
test -z "$1" && while read a b c ; do "$0" "$a" "$b" $c" ; done
instead, to have it process STDIN running self with input as arguments.
精彩评论