0

I'm writing a bash script that, amongst other things, triggers a git commit on a codebase for a specified Drupal 6 site. The script accepts two arguments, the second of which is the commit message for the git commit.

#!/bin/sh

directoryName=${1}
commitMsg=${2}

echo $directoryName
echo $commitMsg

git add .
git commit -vam "The commit message"

The script is called like this:

sh git-bash-test.sh name_of_directory "Custom commit message"

How can I change out "The commit message" for the value stored in $commitMsg?

1
  • 1
    The answer seems too obvious to be what you're really asking; "git commit -vam "${commitMsg}""? Am I missing something? Commented Feb 13, 2011 at 14:27

2 Answers 2

4

Simply replace it with "$commitMsg":

git commit -vam "$commitMsg"

Sign up to request clarification or add additional context in comments.

Comments

1
sh git-bash-test.sh name_of_directory "$commitMsg"

Note the double-quotes around $commitMsg.

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.