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

[PATCH 1/2] git-p4: remove bash-ism in t9809

From
PWPete Wyckoff <pw@padd.com>
Date
Feb 26, 2012, 15:37 UTC
Message-ID
<1330270647-8817-2-git-send-email-pw@padd.com>
In-Reply-To
<1330270647-8817-1-git-send-email-pw@padd.com>

Plain old $# works to count the number of arguments in either bash or dash, even if the arguments have spaces.

Based-on-patch-by: Vitor Antunes <vitor.hda@gmail.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
---
 t/t9809-git-p4-client-view.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9809-git-p4-client-view.sh b/t/t9809-git-p4-client-view.sh
index ae9145e..18d93e4 100755
--- a/t/t9809-git-p4-client-view.sh
+++ b/t/t9809-git-p4-client-view.sh
@@ -31,7 +31,7 @@ client_view() {
 #
 check_files_exist() {
 	ok=0 &&
-	num=${#@} &&
+	num=$# &&
 	for arg ; do
 		test_path_is_file "$arg" &&
 		ok=$(($ok + 1))
-- 
1.7.9.2.288.g74b75
Previous: Pete WyckoffNext: Pete Wyckoff
Message 2 of 5 in “git-p4: remove test bash-isms”
  1. 0/2 git-p4: remove test bash-ismsPete Wyckoff, Feb 26, 2012
  2. 1/2 git-p4: remove bash-ism in t9809Pete Wyckoff, Feb 26, 2012
  3. 2/2 git-p4: remove bash-ism in t9800Pete Wyckoff, Feb 26, 2012
  4. Johannes SixtFeb 26, 2012
  5. Pete WyckoffFeb 26, 2012

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.