No usar echo -n (no es POSIX)

This commit is contained in:
Cat /dev/Nulo 2021-10-11 16:13:38 -03:00
parent f1519be536
commit f63bd3d3ab

View file

@ -1,19 +1,19 @@
#!/bin/sh #!/bin/sh
template () { template () {
echo -n "<!doctype html>" echo "<!doctype html>"
echo -n "<meta charset=utf-8>" echo "<meta charset=utf-8>"
echo -n "<meta name=viewport content='width=device-width, initial-scale=1.0'>" echo "<meta name=viewport content='width=device-width, initial-scale=1.0'>"
echo -n "<link rel=stylesheet href=drip.css>" echo "<link rel=stylesheet href=drip.css>"
echo -n "<title>$1</title>" echo "<title>$1</title>"
if test "$inicio" != true; then if test "$inicio" != true; then
echo -n "<a href=.>☚ Volver al inicio</a>" echo "<a href=.>☚ Volver al inicio</a>"
fi fi
if test -n "$2"; then if test -n "$2"; then
echo -n "<header>" echo "<header>"
echo -n "<h1>$1</h1>" echo "<h1>$1</h1>"
echo -n "<p><small>Último cambio: <time datetime='$(git log -1 --format=%ai "$2")'>$(date -d "@$(git log -1 --format=%at "$2")" '+%Y-%m-%d %H:%M')</time></small></p>" echo "<p><small>Último cambio: <time datetime='$(git log -1 --format=%ai "$2")'>$(date -d "@$(git log -1 --format=%at "$2")" '+%Y-%m-%d %H:%M')</time></small></p>"
echo -n "</header>" echo "</header>"
fi fi
} }
@ -25,7 +25,7 @@ cp *.sh *.md *.css *.png *.mp4 "$outdir"
index="$outdir/index.html" index="$outdir/index.html"
inicio=true header=false template "nulo.in" > "$index" inicio=true header=false template "nulo.in" > "$index"
cmark --unsafe index.md >> "$index" cmark --unsafe index.md >> "$index"
echo -n "<h2>Lista de páginas</h2><ul>" >> "$index" echo "<h2>Lista de páginas</h2><ul>" >> "$index"
for file in *.md; do for file in *.md; do
test "$(basename "$file")" = index.md && continue test "$(basename "$file")" = index.md && continue
@ -36,7 +36,7 @@ for file in *.md; do
# TODO: hacky # TODO: hacky
sed -i "s/<a /<a rel='noopener noreferrer' /gi" "$outfile" sed -i "s/<a /<a rel='noopener noreferrer' /gi" "$outfile"
sed -i 's/\[\[\(.*\)\]\]/<a href="\1.html">\1<\/a>/g' "$outfile" sed -i 's/\[\[\(.*\)\]\]/<a href="\1.html">\1<\/a>/g' "$outfile"
echo -n "<li><a href='$title.html'>$title</a></li>" >> "$index" echo "<li><a href='$title.html'>$title</a></li>" >> "$index"
done done
echo -n "</ul>" >> "$index" echo "</ul>" >> "$index"