# [PATCH] rebase: standardize on $() for command substitution

3 messages from 2007-11-01 to 2007-11-01. Participants: Dan McGee, Junio C Hamano.
Thread: https://gitlist.dev/t/10552

## Dan McGee, 2007-11-01 04:50

Subject: [PATCH] rebase: standardize on $() for command substitution
Message-ID: <1193892608-31322-1-git-send-email-dpmcgee@gmail.com>
URL: https://gitlist.dev/e/1193892608-31322-1-git-send-email-dpmcgee%40gmail.com

```
Commit 889a50e909dba5f4416049afc5eeae601fe133bc changed several `` to $()
format for command substitution, so we should standardize on one format
for clarity.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 git-rebase.sh |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/git-rebase.sh b/git-rebase.sh
index 224cca9..63dea56 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -59,7 +59,7 @@ continue_merge () {
 		die "$RESOLVEMSG"
 	fi
 
-	cmt=`cat "$dotest/current"`
+	cmt=$(cat "$dotest/current")
 	if ! git diff-index --quiet HEAD
 	then
 		if ! git-commit -C "$cmt"
@@ -74,7 +74,7 @@ continue_merge () {
 	fi
 	git rev-list --pretty=oneline -1 "$cmt" | sed -e 's/^[^ ]* //'
 
-	prev_head=`git rev-parse HEAD^0`
+	prev_head=$(git rev-parse HEAD^0)
 	# save the resulting commit so we can read-tree on it later
 	echo "$prev_head" > "$dotest/prev_head"
 
@@ -203,7 +203,7 @@ do
 	-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
 		case "$#,$1" in
 		*,*=*)
-			strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
+			strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)'` ;)
 		1,*)
 			usage ;;
 		*)
@@ -265,7 +265,7 @@ esac
 
 # The upstream head must be given.  Make sure it is valid.
 upstream_name="$1"
-upstream=`git rev-parse --verify "${upstream_name}^0"` ||
+upstream=$(git rev-parse --verify "${upstream_name}^0") ||
     die "invalid upstream $upstream_name"
 
 # Make sure the branch to rebase onto is valid.
@@ -288,9 +288,9 @@ case "$#" in
 	git-checkout "$2" || usage
 	;;
 *)
-	if branch_name=`git symbolic-ref -q HEAD`
+	if branch_name=$(git symbolic-ref -q HEAD)
 	then
-		branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
+		branch_name=$(expr "z$branch_name" : 'zrefs/heads/\(.*\)')
 	else
 		branch_name=HEAD ;# detached
 	fi
@@ -343,11 +343,11 @@ fi
 mkdir -p "$dotest"
 echo "$onto" > "$dotest/onto"
 echo "$onto_name" > "$dotest/onto_name"
-prev_head=`git rev-parse HEAD^0`
+prev_head=$(git rev-parse HEAD^0)
 echo "$prev_head" > "$dotest/prev_head"
 
 msgnum=0
-for cmt in `git rev-list --reverse --no-merges "$upstream"..ORIG_HEAD`
+for cmt in $(git rev-list --reverse --no-merges "$upstream"..ORIG_HEAD)
 do
 	msgnum=$(($msgnum + 1))
 	echo "$cmt" > "$dotest/cmt.$msgnum"
-- 
1.5.3.5

```

## Junio C Hamano, 2007-11-01 05:16

Subject: Re: [PATCH] rebase: standardize on $() for command substitution
Message-ID: <7vr6jaczps.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vr6jaczps.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1193892608-31322-1-git-send-email-dpmcgee@gmail.com>

```
Dan McGee <dpmcgee@gmail.com> writes:

> Commit 889a50e909dba5f4416049afc5eeae601fe133bc changed several `` to $()
> format for command substitution, so we should standardize on one format
> for clarity.
> ...
> @@ -203,7 +203,7 @@ do
>  	-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
>  		case "$#,$1" in
>  		*,*=*)
> -			strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
> +			strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)'` ;)
>  		1,*)
>  			usage ;;
>  		*)

The patch might have meant well, but it is a rather unnecessary
code churn without fixing anything and introducing a bug X-<.

```

## Dan McGee, 2007-11-01 05:27

Subject: Re: [PATCH] rebase: standardize on $() for command substitution
Message-ID: <449c10960710312227s6688cc5fne9ff246e042cdc3c@mail.gmail.com>
URL: https://gitlist.dev/e/449c10960710312227s6688cc5fne9ff246e042cdc3c%40mail.gmail.com
In-Reply-To: <7vr6jaczps.fsf@gitster.siamese.dyndns.org>

```
On 11/1/07, Junio C Hamano <gitster@pobox.com> wrote:
> Dan McGee <dpmcgee@gmail.com> writes:
>
> > Commit 889a50e909dba5f4416049afc5eeae601fe133bc changed several `` to $()
> > format for command substitution, so we should standardize on one format
> > for clarity.
> > ...
> > @@ -203,7 +203,7 @@ do
> >       -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
> >               case "$#,$1" in
> >               *,*=*)
> > -                     strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
> > +                     strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)'` ;)
> >               1,*)
> >                       usage ;;
> >               *)
>
> The patch might have meant well, but it is a rather unnecessary
> code churn without fixing anything and introducing a bug X-<.

Wow, back to the drawing board here. I've been up too long today.

-Dan

```
