0

The below expression

var=$(git log --since='$start_date' --until='$end_date' --author='$commit_author' | grep -i 'merge request\|pull request'  | wc -l)
echo $var 

prints var as zero

but if I echo the above expression

git log --since='2018-04-1' --until='2018-06-30' --author='so.sila@xes.com' | grep -i 'merge request\|pull request'  | wc -l

and copy it and execute via terminal works

why is that var not storing the value and returns zero

Red Ant
  • 315
  • 4
  • 17

1 Answers1

2

The reason is that '$start_date', '$end_date' etc do not expand to their values as they are in single quotes. Try changing it to double quotes and you may have some luck.

Gautam
  • 1,862
  • 9
  • 16