Skip to content

Commit

Permalink
test-gitmw-lib.sh: use the $( ... ) construct for command substitution
Browse files Browse the repository at this point in the history
The Git CodingGuidelines prefer the $(...) construct for command
substitution instead of using the backquotes `...`.

The backquoted form is the traditional method for command
substitution, and is supported by POSIX.  However, all but the
simplest uses become complicated quickly.  In particular, embedded
command substitutions and/or the use of double quotes require
careful escaping with the backslash character.

The patch was generated by:

for _f in $(find . -name "*.sh")
do
   sed -i 's@`\(.*\)`@$(\1)@g' ${_f}
done

and then carefully proof-read.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Elia Pinto authored and Junio C Hamano committed Apr 23, 2014
1 parent 9bfeaa0 commit 0eca37c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contrib/mw-to-git/t/test-gitmw-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test_diff_directories () {
#
# Check that <dir> contains exactly <N> files
test_contains_N_files () {
if test `ls -- "$1" | wc -l` -ne "$2"; then
if test $(ls -- "$1" | wc -l) -ne "$2"; then
echo "directory $1 should contain $2 files"
echo "it contains these files:"
ls "$1"
Expand Down Expand Up @@ -341,10 +341,10 @@ wiki_install () {
"http://download.wikimedia.org/mediawiki/$MW_VERSION_MAJOR/"\
"$MW_FILENAME. "\
"Please fix your connection and launch the script again."
echo "$MW_FILENAME downloaded in `pwd`. "\
echo "$MW_FILENAME downloaded in $(pwd). "\
"You can delete it later if you want."
else
echo "Reusing existing $MW_FILENAME downloaded in `pwd`."
echo "Reusing existing $MW_FILENAME downloaded in $(pwd)."
fi
archive_abs_path=$(pwd)/$MW_FILENAME
cd "$WIKI_DIR_INST/$WIKI_DIR_NAME/" ||
Expand Down

0 comments on commit 0eca37c

Please sign in to comment.