Varun
Varun

Reputation: 3321

Bash Shell scripting - User input

I am new to Shell scripting.

Can anyone tell me what should I do in the script below, so that instead of taking the date/time as a parameter for git commit, it actually prompts me to enter the comment ?

#!/bin/bash

TODAY=$(date)
.............
.............
git commit -m "$TODAY"
............
............

Upvotes: 0

Views: 151

Answers (2)

Jester
Jester

Reputation: 58822

read -p "Comment: " comment
git commit -m "$comment"

Upvotes: 5

Thomas
Thomas

Reputation: 1401

#!/bin/bash
echo "Type the date, followed by [ENTER]:"

read TODAY
git commit -m "$TODAY"

Upvotes: 2

Related Questions