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

Re: [PATCH] Avoid unportable nested double- and backquotes in shell scripts.

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 10, 2011, 18:09 UTC
Message-ID
<7vlj2s636m.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110108090105.GB14536@gmx.de>
Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:
Show 13 quoted lines
> diff --git a/contrib/examples/git-fetch.sh b/contrib/examples/git-fetch.sh
> index a314273..06caf6b 100755
> --- a/contrib/examples/git-fetch.sh
> +++ b/contrib/examples/git-fetch.sh
> @@ -67,7 +67,7 @@ do
>  		keep='-k -k'
>  		;;
>  	--depth=*)
> -		shallow_depth="--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`"
> +		shallow_depth=--depth=`expr "z$1" : 'z-[^=]*=\(.*\)'`
>  		;;
>  	--depth)
>  		shift

I do not very much like the idea of updating contrib/examples, one of whose purposes is to document the historical implementation, to ship a version that has never been battle tested in the field.

There also seem to be a few more uses of `` (the majority used $() even back then) that are still left behind. To make it more useful to serve as an example (which is the other purpose of contrib/examples), it would make more sense to update them all at once.

Show 13 quoted lines
> diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh
> index 289fc31..3d2ae3e 100755
> --- a/t/t9107-git-svn-migrate.sh
> +++ b/t/t9107-git-svn-migrate.sh
> @@ -94,7 +94,7 @@ test_expect_success 'migrate --minimize on old inited layout' '
>  		echo "$svnrepo"$path > "$GIT_DIR"/svn/$ref/info/url ) || exit 1;
>  	done &&
>  	git svn migrate --minimize &&
> -	test -z "`git config -l | grep "^svn-remote\.git-svn\."`" &&
> +	! git config -l | grep "^svn-remote\.git-svn\." &&
>  	git config --get-all svn-remote.svn.fetch > fetch.out &&
>  	grep "^trunk:refs/remotes/trunk$" fetch.out &&
>  	grep "^branches/a:refs/remotes/a$" fetch.out &&
Previous: Jonathan Nieder
Message 6 of 6 in “Avoid unportable nested double- and backquotes in shell scripts.”
  1. Avoid unportable nested double- and backquotes in shell scripts.Ralf Wildenhues, Jan 8, 2011
  2. Jonathan NiederJan 8, 2011
  3. Ralf WildenhuesJan 8, 2011
  4. Jonathan NiederJan 8, 2011
  5. Jonathan NiederJan 8, 2011
  6. Junio C HamanoJan 10, 2011

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.