Skip to content

Commit 6753d8a

Browse files
committed
Merge branch 'ep/shell-command-substitution'
Adjust shell scripts to use $(cmd) instead of `cmd`. * ep/shell-command-substitution: (41 commits) t5000-tar-tree.sh: use the $( ... ) construct for command substitution t4204-patch-id.sh: use the $( ... ) construct for command substitution t4119-apply-config.sh: use the $( ... ) construct for command substitution t4116-apply-reverse.sh: use the $( ... ) construct for command substitution t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution t4038-diff-combined.sh: use the $( ... ) construct for command substitution t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution t4014-format-patch.sh: use the $( ... ) construct for command substitution t4013-diff-various.sh: use the $( ... ) construct for command substitution t4012-diff-binary.sh: use the $( ... ) construct for command substitution t4010-diff-pathspec.sh: use the $( ... ) construct for command substitution t4006-diff-mode.sh: use the $( ... ) construct for command substitution t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution t1050-large.sh: use the $( ... ) construct for command substitution t1020-subdirectory.sh: use the $( ... ) construct for command substitution t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution ...
2 parents 6d3c4e9 + f5efd51 commit 6753d8a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+174
-174
lines changed

contrib/mw-to-git/t/t9365-continuing-queries.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test_check_precond
99

1010
test_expect_success 'creating page w/ >500 revisions' '
1111
wiki_reset &&
12-
for i in `test_seq 501`
12+
for i in $(test_seq 501)
1313
do
1414
echo "creating revision $i" &&
1515
wiki_editpage foo "revision $i<br/>" true

contrib/mw-to-git/t/test-gitmw-lib.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ test_diff_directories () {
9090
#
9191
# Check that <dir> contains exactly <N> files
9292
test_contains_N_files () {
93-
if test `ls -- "$1" | wc -l` -ne "$2"; then
93+
if test $(ls -- "$1" | wc -l) -ne "$2"; then
9494
echo "directory $1 should contain $2 files"
9595
echo "it contains these files:"
9696
ls "$1"
@@ -340,10 +340,10 @@ wiki_install () {
340340
"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
341341
"$MW_FILENAME. "\
342342
"Please fix your connection and launch the script again."
343-
echo "$MW_FILENAME downloaded in `pwd`. "\
343+
echo "$MW_FILENAME downloaded in $(pwd). "\
344344
"You can delete it later if you want."
345345
else
346-
echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
346+
echo "Reusing existing $MW_FILENAME downloaded in $(pwd)."
347347
fi
348348
archive_abs_path=$(pwd)/$MW_FILENAME
349349
cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||

contrib/subtree/t/t7900-subtree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ test_expect_success 'add sub1' '
7676

7777
# Save this hash for testing later.
7878

79-
subdir_hash=`git rev-parse HEAD`
79+
subdir_hash=$(git rev-parse HEAD)
8080

8181
test_expect_success 'add sub2' '
8282
create sub2 &&

contrib/thunderbird-patch-inline/appp.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CONFFILE=~/.appprc
1010

1111
SEP="-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-"
1212
if [ -e "$CONFFILE" ] ; then
13-
LAST_DIR=`grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//'`
13+
LAST_DIR=$(grep -m 1 "^LAST_DIR=" "${CONFFILE}"|sed -e 's/^LAST_DIR=//')
1414
cd "${LAST_DIR}"
1515
else
1616
cd > /dev/null
@@ -25,11 +25,11 @@ fi
2525

2626
cd - > /dev/null
2727

28-
SUBJECT=`sed -n -e '/^Subject: /p' "${PATCH}"`
29-
HEADERS=`sed -e '/^'"${SEP}"'$/,$d' $1`
30-
BODY=`sed -e "1,/${SEP}/d" $1`
31-
CMT_MSG=`sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}"`
32-
DIFF=`sed -e '1,/^---$/d' "${PATCH}"`
28+
SUBJECT=$(sed -n -e '/^Subject: /p' "${PATCH}")
29+
HEADERS=$(sed -e '/^'"${SEP}"'$/,$d' $1)
30+
BODY=$(sed -e "1,/${SEP}/d" $1)
31+
CMT_MSG=$(sed -e '1,/^$/d' -e '/^---$/,$d' "${PATCH}")
32+
DIFF=$(sed -e '1,/^---$/d' "${PATCH}")
3333

3434
CCS=`echo -e "$CMT_MSG\n$HEADERS" | sed -n -e 's/^Cc: \(.*\)$/\1,/gp' \
3535
-e 's/^Signed-off-by: \(.*\)/\1,/gp'`
@@ -48,7 +48,7 @@ if [ "x${BODY}x" != "xx" ] ; then
4848
fi
4949
echo "$DIFF" >> $1
5050

51-
LAST_DIR=`dirname "${PATCH}"`
51+
LAST_DIR=$(dirname "${PATCH}")
5252

5353
grep -v "^LAST_DIR=" "${CONFFILE}" > "${CONFFILE}_"
5454
echo "LAST_DIR=${LAST_DIR}" >> "${CONFFILE}_"

git-pull.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ do
108108
-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
109109
case "$#,$1" in
110110
*,*=*)
111-
strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
111+
strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)') ;;
112112
1,*)
113113
usage ;;
114114
*)

git-rebase--merge.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ continue_merge () {
2424
die "$resolvemsg"
2525
fi
2626

27-
cmt=`cat "$state_dir/current"`
27+
cmt=$(cat "$state_dir/current")
2828
if ! git diff-index --quiet --ignore-submodules HEAD --
2929
then
3030
if ! git commit ${gpg_sign_opt:+"$gpg_sign_opt"} --no-verify -C "$cmt"
@@ -143,7 +143,7 @@ echo "$onto_name" > "$state_dir/onto_name"
143143
write_basic_state
144144

145145
msgnum=0
146-
for cmt in `git rev-list --reverse --no-merges "$revisions"`
146+
for cmt in $(git rev-list --reverse --no-merges "$revisions")
147147
do
148148
msgnum=$(($msgnum + 1))
149149
echo "$cmt" > "$state_dir/cmt.$msgnum"

git-rebase.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@ then
457457
else
458458
if test -z "$onto"
459459
then
460-
empty_tree=`git hash-object -t tree /dev/null`
461-
onto=`git commit-tree $empty_tree </dev/null`
460+
empty_tree=$(git hash-object -t tree /dev/null)
461+
onto=$(git commit-tree $empty_tree </dev/null)
462462
squash_onto="$onto"
463463
fi
464464
unset upstream_name
@@ -516,10 +516,10 @@ case "$#" in
516516
;;
517517
0)
518518
# Do not need to switch branches, we are already on it.
519-
if branch_name=`git symbolic-ref -q HEAD`
519+
if branch_name=$(git symbolic-ref -q HEAD)
520520
then
521521
head_name=$branch_name
522-
branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
522+
branch_name=$(expr "z$branch_name" : 'zrefs/heads/\(.*\)')
523523
else
524524
head_name="detached HEAD"
525525
branch_name=HEAD ;# detached

git-stash.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ USAGE="list [<options>]
1313

1414
SUBDIRECTORY_OK=Yes
1515
OPTIONS_SPEC=
16-
START_DIR=`pwd`
16+
START_DIR=$(pwd)
1717
. git-sh-setup
1818
. git-sh-i18n
1919
require_work_tree

git-web--browse.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ do
5959
-b|--browser*|-t|--tool*)
6060
case "$#,$1" in
6161
*,*=*)
62-
browser=`expr "z$1" : 'z-[^=]*=\(.*\)'`
62+
browser=$(expr "z$1" : 'z-[^=]*=\(.*\)')
6363
;;
6464
1,*)
6565
usage ;;
@@ -71,7 +71,7 @@ do
7171
-c|--config*)
7272
case "$#,$1" in
7373
*,*=*)
74-
conf=`expr "z$1" : 'z-[^=]*=\(.*\)'`
74+
conf=$(expr "z$1" : 'z-[^=]*=\(.*\)')
7575
;;
7676
1,*)
7777
usage ;;
@@ -100,7 +100,7 @@ then
100100
for opt in "$conf" "web.browser"
101101
do
102102
test -z "$opt" && continue
103-
browser="`git config $opt`"
103+
browser="$(git config $opt)"
104104
test -z "$browser" || break
105105
done
106106
if test -n "$browser" && ! valid_tool "$browser"; then

t/lib-credential.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ helper_test_timeout() {
281281
cat >askpass <<\EOF
282282
#!/bin/sh
283283
echo >&2 askpass: $*
284-
what=`echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z`
284+
what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
285285
echo "askpass-$what"
286286
EOF
287287
chmod +x askpass

0 commit comments

Comments
 (0)