Ich schreibe ein Skript, um Draft-Posts für mein Blog zu erstellen. Nach dem Ausführen von ShellCheck sehe ich diesen Fehler Pop-up. Was bedeutet das und kann jemand ein Beispiel geben?Was bedeutet dieser Fehler? (SC2129: Verwenden Sie statt einzelner Weiterleitungen die Datei {cmd1; cmd2;} >>.)
SC2129: Consider using { cmd1; cmd2; } >> file instead of individual redirects.
Außerdem bin ich nicht sicher, was ich tun, um müssen den Wert von $title
zum "Title"
Feld in der YAML Post passieren ...
#!/bin/bash
# Set some variables
var site_path=~/Documents/Blog
drafts_path=~/Documents/Blog/_drafts
title="$title"
# Create the filename
title=$("$title" | "awk {print tolower($0)}")
filename="$title.markdown"
file_path="$drafts_path/$filename"
echo "File path: $file_path"
# Create the file, Add metadata fields
echo "---" > "$file_path"
{
echo "title: \"$title\""
} >> "$file_path"
echo "layout: post" >> "$file_path"
echo "tags: " >> "$file_path"
echo "---" >> "$file_path"
# Open the file in BBEdit
bbedit "$file_path"
exit 0
'{echo 'foo'; echo 'bar'; echo 'baz'; } >> file' statt separat/wiederholt 'echo x >> file' –