From d1bc231b91911e7e072d1cff26988279fafb2dfd Mon Sep 17 00:00:00 2001 From: Konstantin Nazarov Date: Sat, 21 Aug 2021 19:08:38 +0100 Subject: [PATCH] Fix basics to work on OS X. Still have a few things to go. --- notes.sh | 4 ++-- test.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/notes.sh b/notes.sh index 27f2849..0903c98 100755 --- a/notes.sh +++ b/notes.sh @@ -230,7 +230,7 @@ unpack_part() { BOUNDARY=$(echo "$MIME_TYPE" | sed -n 's/^.*boundary="\(.*\)"$/\1/p') i=1 while true; do - TMP=$(mktemp --tmpdir="$DIR") + TMP=$(mktemp "$DIR/tmp.XXXXXXXX") get_part "$FILE" "$BOUNDARY" "$i" > "$TMP" ((i++)) if [ ! -s "$TMP" ]; then @@ -256,7 +256,7 @@ unpack_mime() { get_headers "$FILE" | grep -v "^Content-Type\|^Content-Disposition\|^Date\|^MIME-Version" >> "$DIR/note.md" echo "" >> "$DIR/note.md" - TMP=$(mktemp --tmpdir="$DIR") + TMP=$(mktemp "$DIR/tmp.XXXXXXXX") cat "$FILE" > "$TMP" (unpack_part "$TMP" "$DIR") diff --git a/test.sh b/test.sh index eac14ac..3db1f40 100755 --- a/test.sh +++ b/test.sh @@ -231,7 +231,7 @@ resume_editing() { "$BASE_DIR/notes.sh" -e "$NOTE_ID" 2>/dev/null || true OUTPUT="$(cat "$(pwd)/notes/cur"/*)" - assert 'echo "$OUTPUT" | grep myline | wc -l' "1" + assert 'echo "$OUTPUT" | grep myline | wc -l | tr -d " "' "1" cat > "$(pwd)/editor.sh" <<- EOF #!/bin/bash