# [PATCH]: git-merge-one-file-script use /usr/bin/env to call bash

11 messages from 2005-05-07 to 2005-05-09. Participants: Thomas Glanzmann, Junio C Hamano, bert hubert, Martin Waitz, Morten Welinder, H. Peter Anvin.
Thread: https://gitlist.dev/t/524

## Thomas Glanzmann, 2005-05-07 08:45

Subject: [PATCH]: git-merge-one-file-script use /usr/bin/env to call bash
Message-ID: <20050507084549.GF23680@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050507084549.GF23680%40cip.informatik.uni-erlangen.de

```
[PATCH]: git-merge-one-file-script use /usr/bin/env to call bash

Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>

--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
 #
 # This is the git merge script, called with
 #

```

## Junio C Hamano, 2005-05-07 08:52

Subject: Re: [PATCH]: git-merge-one-file-script use /usr/bin/env to call bash
Message-ID: <7v3bszbeoo.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v3bszbeoo.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050507084549.GF23680@cip.informatik.uni-erlangen.de>

```
A quick question.  Which construct in this bashism?
Not using backtick but saying $(command)?


```

## Thomas Glanzmann, 2005-05-07 09:05

Subject: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <20050507090543.GG23680@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050507090543.GG23680%40cip.informatik.uni-erlangen.de
In-Reply-To: <7v3bszbeoo.fsf@assigned-by-dhcp.cox.net>

```
Hello,

* Junio C Hamano <junkio@cox.net> [050507 10:54]:
> A quick question.  Which construct in this bashism?
> Not using backtick but saying $(command)?

Exactly:

	(faui04a) [~/work/git/git-solaris] git pull
	head => 46dd99f970d283dc0de440c06fca8f4586b70548
	remote => e7d3dd248f50501f98b29c917e70bddcf3ea925a
	base => 74c7cfa875448c71a18d21a0cc7c973afe759fa5
	Documentation/core-git.txt: unmerged (8bd893197e6e769b6e03ca1206e355214e16d56a)
	local-pull.c: unmerged (4f52bca48c390e8113b3695a53ce62e0c23278a8)
	local-pull.c: unmerged (a8af725467cde6653160511e468a1fda4e004503)
	local-pull.c: unmerged (1eec8927dbfa3af934651b25ded738d192706286)
	sha1_file.c: unmerged (e6ce455ae90bd430f2128f454bdb6e0575412486)
	sha1_file.c: unmerged (7887b6481ae5c9368a24bf053f79dbbc1f039300)
	sha1_file.c: unmerged (f1c1c70d784aa0587cd4c7143c3d464fd8e5ddc6)
	fatal: write-tree: not able to write tree

This is it:
	/home/cip/adm/sithglan/work/git/bin/git-SunOS/bin/git-merge-one-file-script: syntax error at line 55: `orig=$' unexpected
	fatal: merge program failed
	git-merge-cache failed: child exit value: 1 at /home/cip/adm/sithglan/work/git/yagf/git line 1015.

The attached patch at the end of this eMail fixes it for me *without*
touching /bin/sh in the bang:

	(faui04a) [~/work/git/git-solaris] git pull
	head => 46dd99f970d283dc0de440c06fca8f4586b70548
	remote => e7d3dd248f50501f98b29c917e70bddcf3ea925a
	base => 74c7cfa875448c71a18d21a0cc7c973afe759fa5
	Documentation/core-git.txt: unmerged (8bd893197e6e769b6e03ca1206e355214e16d56a)
	local-pull.c: unmerged (4f52bca48c390e8113b3695a53ce62e0c23278a8)
	local-pull.c: unmerged (a8af725467cde6653160511e468a1fda4e004503)
	local-pull.c: unmerged (1eec8927dbfa3af934651b25ded738d192706286)
	sha1_file.c: unmerged (e6ce455ae90bd430f2128f454bdb6e0575412486)
	sha1_file.c: unmerged (7887b6481ae5c9368a24bf053f79dbbc1f039300)
	sha1_file.c: unmerged (f1c1c70d784aa0587cd4c7143c3d464fd8e5ddc6)
	fatal: write-tree: not able to write tree
	Threewaydiff invloved.

[PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility

Signed-Off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de>

--- a/git-merge-one-file-script
+++ b/git-merge-one-file-script
@@ -52,9 +52,9 @@
 #
 "$1$2$3")
 	echo "Auto-merging $4."
-	orig=$(git-unpack-file $1)
-	src1=$(git-unpack-file $2)
-	src2=$(git-unpack-file $3)
+	orig=`git-unpack-file $1`
+	src1=`git-unpack-file $2`
+	src2=`git-unpack-file $3`
 	merge "$src2" "$orig" "$src1"
 	ret=$?
 	if [ "$6" != "$7" ]; then
@@ -64,7 +64,7 @@
 		echo "ERROR: Leaving conflict merge in $src2."
 		exit 1
 	fi
-	sha1=$(git-write-blob "$src2") || {
+	sha1=`git-write-blob "$src2"` || {
 		echo "ERROR: Leaving conflict merge in $src2."
 	}
 	exec git-update-cache --add --cacheinfo "$6" $sha1 "$4" ;;

```

## bert hubert, 2005-05-07 10:03

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <20050507100348.GA16461@outpost.ds9a.nl>
URL: https://gitlist.dev/e/20050507100348.GA16461%40outpost.ds9a.nl
In-Reply-To: <20050507090543.GG23680@cip.informatik.uni-erlangen.de>

```
On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
> * Junio C Hamano <junkio@cox.net> [050507 10:54]:
> > A quick question.  Which construct in this bashism?
> > Not using backtick but saying $(command)?

You can nest $() which is valuable, unlike backtics.

-- 
http://www.PowerDNS.com      Open source, database driven DNS Software 
http://netherlabs.nl              Open and Closed source services

```

## Thomas Glanzmann, 2005-05-07 10:15

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <20050507101530.GH23680@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050507101530.GH23680%40cip.informatik.uni-erlangen.de
In-Reply-To: <20050507100348.GA16461@outpost.ds9a.nl>

```
Hello,

> You can nest $() which is valuable, unlike backtics.

we're aware of this. But the specific script works perfectly fine
without nested simple-command redirection. So what is your point?

	Thomas

```

## Martin Waitz, 2005-05-07 17:24

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <20050507172429.GJ3562@admingilde.org>
URL: https://gitlist.dev/e/20050507172429.GJ3562%40admingilde.org
In-Reply-To: <20050507090543.GG23680@cip.informatik.uni-erlangen.de>

```
hoi :)

On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
> * Junio C Hamano <junkio@cox.net> [050507 10:54]:
> > A quick question.  Which construct in this bashism?
> > Not using backtick but saying $(command)?
> 
> Exactly:

huh? which broken shell does not understand $()?

-- 
Martin Waitz

```

## Junio C Hamano, 2005-05-07 18:38

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <7vy8aqanlh.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vy8aqanlh.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20050507101530.GH23680@cip.informatik.uni-erlangen.de>

```
>>>>> "TG" == Thomas Glanzmann <sithglan@stud.uni-erlangen.de> writes:

TG> Hello,
>> You can nest $() which is valuable, unlike backtics.

TG> we're aware of this. But the specific script works perfectly fine
TG> without nested simple-command redirection. So what is your point?

If that is the case then I think the patch you posted to force
bash is backwards.  How about changing it to use backticks?


```

## Morten Welinder, 2005-05-07 20:22

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <118833cc0505071322480e8e09@mail.gmail.com>
URL: https://gitlist.dev/e/118833cc0505071322480e8e09%40mail.gmail.com
In-Reply-To: <20050507172429.GJ3562@admingilde.org>

```
On 5/7/05, Martin Waitz <tali@admingilde.org> wrote:
> hoi :)
> 
> On Sat, May 07, 2005 at 11:05:43AM +0200, Thomas Glanzmann wrote:
> > * Junio C Hamano <junkio@cox.net> [050507 10:54]:
> > > A quick question.  Which construct in this bashism?
> > > Not using backtick but saying $(command)?
> >
> > Exactly:
> 
> huh? which broken shell does not understand $()?

Solaris' /bin/sh

I thought everything we were relying on bash anyway.  It'll take it.

Morten

```

## Thomas Glanzmann, 2005-05-07 23:15

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <20050507231505.GA2497@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050507231505.GA2497%40cip.informatik.uni-erlangen.de
In-Reply-To: <7vy8aqanlh.fsf@assigned-by-dhcp.cox.net>

```
Hello,

> If that is the case then I think the patch you posted to force
> bash is backwards.  How about changing it to use backticks?

agreed. Already did that see previous eMail.

	Thomas

```

## Thomas Glanzmann, 2005-05-07 23:15

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <20050507231539.GB2497@cip.informatik.uni-erlangen.de>
URL: https://gitlist.dev/e/20050507231539.GB2497%40cip.informatik.uni-erlangen.de
In-Reply-To: <20050507172429.GJ3562@admingilde.org>

```
Hello Coworker,

> huh? which broken shell does not understand $()?

/bin/sh under Solaris 9 for example. That is where I hit it initial.

	Thomas

```

## H. Peter Anvin, 2005-05-09 14:47

Subject: Re: [PATCH] Use backticks instead of $(command) to maintain /bin/sh compatibility
Message-ID: <427F77F6.1090308@zytor.com>
URL: https://gitlist.dev/e/427F77F6.1090308%40zytor.com
In-Reply-To: <20050507231539.GB2497@cip.informatik.uni-erlangen.de>

```
Thomas Glanzmann wrote:
> Hello Coworker,
> 
> 
>>huh? which broken shell does not understand $()?
> 
> 
> /bin/sh under Solaris 9 for example. That is where I hit it initial.
> 

Shoot Sun.

$(...) is in POSIX and has been for oh, what, 15 years now?

	-hpa

```
