git/Documentation/howto-index.sh
Elia Pinto f25f5e61a7 howto-index.sh: use the $( ... ) construct for command substitution
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>
2014-04-17 11:14:57 -07:00

57 lines
673 B
Bash
Executable File

#!/bin/sh
cat <<\EOF
Git Howto Index
===============
Here is a collection of mailing list postings made by various
people describing how they use Git in their workflow.
EOF
for txt
do
title=$(expr "$txt" : '.*/\(.*\)\.txt$')
from=$(sed -ne '
/^$/q
/^From:[ ]/{
s///
s/^[ ]*//
s/[ ]*$//
s/^/by /
p
}
' "$txt")
abstract=$(sed -ne '
/^Abstract:[ ]/{
s/^[^ ]*//
x
s/.*//
x
: again
/^[ ]/{
s/^[ ]*//
H
n
b again
}
x
p
q
}' "$txt")
if grep 'Content-type: text/asciidoc' >/dev/null $txt
then
file=$(expr "$txt" : '\(.*\)\.txt$').html
else
file="$txt"
fi
echo "* link:$file[$title] $from
$abstract
"
done