git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-rebase.sh: Use POSIX/Susv command substitution instead of backticks

From
Jari Aalto <jari.aalto@cante.net>
Date
Feb 5, 2008, 22:08 UTC
Message-ID
<lk5zxdix.fsf@blue.sea.net>

Use redable $(<command>) syntax instead of backtics in code. See The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition

Signed-off-by: Jari Aalto <jari.aalto AT cante.net>
---
 See http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_03
 git-rebase.sh |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index bdcea0e..d2b329f 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -60,7 +60,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"
@@ -75,7 +75,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"
 
@@ -233,7 +233,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 ;;
 		*)
@@ -295,7 +295,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.
@@ -318,9 +318,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
@@ -399,7 +399,7 @@ echo "$orig_head" > "$dotest/orig-head"
 echo "$head_name" > "$dotest/head-name"
 
 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.4-rc5.GIT-dirty


-- 
Welcome to FOSS revolution: we fix and modify until it shines
Next: Johannes Schindelin
Message 1 of 7 in “git-rebase.sh: Use POSIX/Susv command substitution instead of backticks”
  1. git-rebase.sh: Use POSIX/Susv command substitution instead of backticksJari Aalto, Feb 5, 2008
  2. Johannes SchindelinFeb 5, 2008
  3. Jari AaltoFeb 5, 2008
  4. Johannes SchindelinFeb 5, 2008
  5. Junio C HamanoFeb 6, 2008
  6. Junio C HamanoFeb 6, 2008
  7. Ralf WildenhuesFeb 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.