From 8c7ec4a9b975e61c4953eb1699ae6052c0529c42 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Fri, 7 Jan 2022 21:28:42 +0000 Subject: shellcheck edits --- process_hsbc_transactions.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/process_hsbc_transactions.sh b/process_hsbc_transactions.sh index 0b37204..63cecb4 100755 --- a/process_hsbc_transactions.sh +++ b/process_hsbc_transactions.sh @@ -16,22 +16,22 @@ else "Cannot find $tf. Expecting it either in ~/Downloads or in current folder." fi # remove the BOM (https://stackoverflow.com/questions/45240387/how-can-i-remove-the-bom-from-a-utf-8-file) -sed -i $'1s/^\uFEFF//' $tpath +sed -i $'1s/^\uFEFF//' "$tpath" # read the file and process lines -while read line; do +while read -r line; do line=${line//"-"/"£"} - echo -e "$line\n$(cat $tmpfile)" > $tmpfile -done < $tpath + echo -e "$line\n$(cat "$tmpfile")" > "$tmpfile" +done < "$tpath" # how to append to a text file in bash -echo -e "Date,Description,Amount\n$(cat $tmpfile)" > $tmpfile +echo -e "Date,Description,Amount\n$(cat "$tmpfile")" > "$tmpfile" # use ledger to convert to ledger format -$(ledger convert --input-date-format "%d/%m/%Y" $tmpfile > $ledgertmp) +ledger convert --input-date-format "%d/%m/%Y" "$tmpfile" > "$ledgertmp" # Remove the erroneous Equity lines -sed -i '/Equity:Unknown/d' $ledgertmp +sed -i '/Equity:Unknown/d' "$ledgertmp" # dump to sdout for further redirection -cat $ledgertmp +cat "$ledgertmp" -- cgit v1.2.3