Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3999034
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:36:15+00:00 2026-05-20T07:36:15+00:00

I am new to Linux as well as for Subversion. I had a task

  • 0

I am new to Linux as well as for Subversion. I had a task to check the syntax of the commit message to contain PRODUCT ID. If its not present I have pass a message to user saying an invalid format using SHELL SCRIPT.
Below are the steps I had followed after a lot search in google,
For the PRE-COMMIT hook the code is:

#!/bin/sh  
set -e  
/PATH-TO-REPOSITORY/hooks/CommentSyntax.sh "$1" "$2"  

My CommentSyntax.sh script is,

#!/bin/sh  
REPOS="$1"  
TXN="$2"  
SVNLOOK=/usr/bin/svnlook  
regex="PRODUCT-[0-9]*"  
if [ `"$SVNLOOK" log -t "$TXN" "$REPOS"` =~ ${regex} ]; then  
    exit 0  
else  
  echo "" 1>&2    
  echo "Please make your commit comment start with PRODUCT-XXX" 1>&2  
  exit 1  
fi

Whenever I am trying to check-in the code, am getting the below error,

srikanth:~/testing$ svn ci -m "PRODUCT-123"
Sending        two.java
Transmitting file data .svn: Commit failed (details follow):
svn: Commit blocked by pre-commit hook (exit code 1) with output:
[: 22: PRODUCT-123: unexpected operator

Please make your commit comment start with PRODUCT-XXX

I am not sure where I gone wrong. Request your valuable advice on the same.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:36:15+00:00Added an answer on May 20, 2026 at 7:36 am

    The test command knows no =~ operator. Relpace the

    if [ `"$SVNLOOK" log -t "$TXN" "$REPOS"` =~ ${regex} ]; then  
    

    line by

    if "$SVNLOOK" log -t "$TXN" "$REPOS" | head -n1 | grep -q '^PRODUCT-[0-9][0-9]*' ; then
    

    head -n1 select the first line of the commit, grep checks the regexp.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement some kind of new Linux task scheduler so I
I'm new to Linux/CentOS and I'm not having the most fun using it. I
I recently installed rails in fedora 12. I'm new to linux as well. Everything
Well, I'm new to linux so this may be a very newbie kinda of
Hey I am new to rails (as well as linux) and I keep getting
I am quite new to the embedded linux programming and did not really understand
I'm very new to Linux and programming on Linux. I'm trying to install OpenAL
I am rather new to Linux device driver programmring, but for debugging purposes, I
I am new to Linux and I am attempting to install the PHP PEAR
Hi I'm new to Linux and I really like the idea of writing and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.