Fix shellcheck warnings

This commit is contained in:
Konstantin Nazarov 2021-05-29 11:04:21 +00:00
parent f0785bef6d
commit dfe6ff0c69
Signed by: knazarov
GPG key ID: 4CFE0A42FA409C22

View file

@ -100,14 +100,14 @@ yesno() {
if [[ "$DEFAULT" == "y" ]]; then if [[ "$DEFAULT" == "y" ]]; then
read -p "$PROMPT [Y/n] " -r CHOICE read -p "$PROMPT [Y/n] " -r CHOICE
if [[ "$REPLY" =~ ^[Nn]$ ]]; then if [[ "$CHOICE" =~ ^[Nn]$ ]]; then
echo "n" echo "n"
else else
echo "y" echo "y"
fi fi
else else
read -p "$PROMPT [y/N] " -r CHOICE read -p "$PROMPT [y/N] " -r CHOICE
if [[ "$REPLY" =~ ^[Yy]$ ]]; then if [[ "$CHOICE" =~ ^[Yy]$ ]]; then
echo "y" echo "y"
else else
echo "n" echo "n"
@ -257,14 +257,14 @@ pack_part() {
echo "Content-Type: $CONTENT_TYPE" echo "Content-Type: $CONTENT_TYPE"
echo "Content-Transfer-Encoding: base64" echo "Content-Transfer-Encoding: base64"
echo echo
cat "$PART_FILE" | base64 base64 < "$PART_FILE"
fi fi
} }
pack_mime() { pack_mime() {
DIR="$1" DIR="$1"
FILE="$2" FILE="$2"
FILE_COUNT="$(ls "$DIR" | wc -l)" FILE_COUNT="$(find "$DIR/" -type f | wc -l)"
MIME_TIMESTAMP=$(LC_ALL="en_US.UTF-8" date "+$DATE_FORMAT") MIME_TIMESTAMP=$(LC_ALL="en_US.UTF-8" date "+$DATE_FORMAT")
if [[ "$FILE_COUNT" == "1" ]]; then if [[ "$FILE_COUNT" == "1" ]]; then
@ -293,7 +293,7 @@ pack_mime() {
} >> "$FILE" } >> "$FILE"
find "$DIR/" -type f ! -name 'note.md' | while read FN find "$DIR/" -type f ! -name 'note.md' | while read -r FN
do do
{ {
echo "--$BOUNDARY" echo "--$BOUNDARY"
@ -339,9 +339,7 @@ new_entry() {
fi fi
MERGED_ENTRY_FILE="$(mktemp)" MERGED_ENTRY_FILE="$(mktemp)"
HEADERS=$( echo "$( HEADERS=$(get_headers "$ENTRY_FILE" | tac | sort -u -k1,1)
get_headers "$ENTRY_FILE"
)" | tac | sort -u -k1,1)
{ {
echo "$HEADERS" echo "$HEADERS"